@wise/dynamic-flow-client 2.2.1 → 2.3.0-beta-c55f65.18
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/build/i18n/en.json +2 -0
- package/build/i18n/hu.json +1 -1
- package/build/main.css +19 -0
- package/build/main.js +486 -206
- package/build/main.min.js +8 -1
- package/build/types/common/utils/index.d.ts +1 -0
- package/build/types/common/utils/mobile-utils.d.ts +4 -0
- package/build/types/layout/form/DynamicForm.d.ts +1 -1
- package/build/types/revamp/DynamicFlowRevamp.d.ts +3 -0
- package/build/types/revamp/domain/AlertComponent.d.ts +14 -0
- package/build/types/revamp/domain/HeadingComponent.d.ts +16 -0
- package/build/types/revamp/domain/ParagraphComponent.d.ts +16 -0
- package/build/types/revamp/domain/Step.d.ts +9 -0
- package/build/types/revamp/domain/types.d.ts +8 -0
- package/build/types/revamp/mappers/componentToProps/alertComponentToProps.d.ts +3 -0
- package/build/types/revamp/mappers/componentToProps/headingComponentToProps.d.ts +3 -0
- package/build/types/revamp/mappers/componentToProps/paragraphComponentToProps.d.ts +3 -0
- package/build/types/revamp/mappers/specToDomain/alertLayoutToDomain.d.ts +2 -0
- package/build/types/revamp/mappers/specToDomain/headingLayoutToDomain.d.ts +2 -0
- package/build/types/revamp/mappers/specToDomain/mapStepToDomain.d.ts +4 -0
- package/build/types/revamp/mappers/specToDomain/paragraphLayoutToDomain.d.ts +2 -0
- package/build/types/revamp/renderers/neptune/AlertRenderer.d.ts +3 -0
- package/build/types/revamp/renderers/neptune/HeadingRenderer.d.ts +3 -0
- package/build/types/revamp/renderers/neptune/ParagraphRenderer.d.ts +3 -0
- package/build/types/revamp/renderers/neptune/utils/layout-utils.d.ts +7 -0
- package/build/types/revamp/renderers/types.d.ts +31 -0
- package/build/types/revamp/renderers/utils/renderComponent.d.ts +7 -0
- package/build/types/revamp/step/Step.d.ts +8 -0
- package/build/types/revamp/stories/utils/fixtureHttpClient.d.ts +2 -0
- package/build/types/step/cameraStep/cameraCapture/components/index.d.ts +1 -0
- package/build/types/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +2 -0
- package/build/types/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.d.ts +13 -0
- package/build/types/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +4 -0
- package/package.json +26 -26
- /package/build/types/step/cameraStep/cameraCapture/hooks/{index.d.ts → useVideoConstraints.d.ts} +0 -0
package/build/main.js
CHANGED
|
@@ -529,6 +529,169 @@ var require_react_webcam = __commonJS({
|
|
|
529
529
|
}
|
|
530
530
|
});
|
|
531
531
|
|
|
532
|
+
// ../../node_modules/.pnpm/screenfull@5.2.0/node_modules/screenfull/dist/screenfull.js
|
|
533
|
+
var require_screenfull = __commonJS({
|
|
534
|
+
"../../node_modules/.pnpm/screenfull@5.2.0/node_modules/screenfull/dist/screenfull.js"(exports, module2) {
|
|
535
|
+
"use strict";
|
|
536
|
+
(function() {
|
|
537
|
+
"use strict";
|
|
538
|
+
var document2 = typeof window !== "undefined" && typeof window.document !== "undefined" ? window.document : {};
|
|
539
|
+
var isCommonjs = typeof module2 !== "undefined" && module2.exports;
|
|
540
|
+
var fn = function() {
|
|
541
|
+
var val;
|
|
542
|
+
var fnMap = [
|
|
543
|
+
[
|
|
544
|
+
"requestFullscreen",
|
|
545
|
+
"exitFullscreen",
|
|
546
|
+
"fullscreenElement",
|
|
547
|
+
"fullscreenEnabled",
|
|
548
|
+
"fullscreenchange",
|
|
549
|
+
"fullscreenerror"
|
|
550
|
+
],
|
|
551
|
+
// New WebKit
|
|
552
|
+
[
|
|
553
|
+
"webkitRequestFullscreen",
|
|
554
|
+
"webkitExitFullscreen",
|
|
555
|
+
"webkitFullscreenElement",
|
|
556
|
+
"webkitFullscreenEnabled",
|
|
557
|
+
"webkitfullscreenchange",
|
|
558
|
+
"webkitfullscreenerror"
|
|
559
|
+
],
|
|
560
|
+
// Old WebKit
|
|
561
|
+
[
|
|
562
|
+
"webkitRequestFullScreen",
|
|
563
|
+
"webkitCancelFullScreen",
|
|
564
|
+
"webkitCurrentFullScreenElement",
|
|
565
|
+
"webkitCancelFullScreen",
|
|
566
|
+
"webkitfullscreenchange",
|
|
567
|
+
"webkitfullscreenerror"
|
|
568
|
+
],
|
|
569
|
+
[
|
|
570
|
+
"mozRequestFullScreen",
|
|
571
|
+
"mozCancelFullScreen",
|
|
572
|
+
"mozFullScreenElement",
|
|
573
|
+
"mozFullScreenEnabled",
|
|
574
|
+
"mozfullscreenchange",
|
|
575
|
+
"mozfullscreenerror"
|
|
576
|
+
],
|
|
577
|
+
[
|
|
578
|
+
"msRequestFullscreen",
|
|
579
|
+
"msExitFullscreen",
|
|
580
|
+
"msFullscreenElement",
|
|
581
|
+
"msFullscreenEnabled",
|
|
582
|
+
"MSFullscreenChange",
|
|
583
|
+
"MSFullscreenError"
|
|
584
|
+
]
|
|
585
|
+
];
|
|
586
|
+
var i = 0;
|
|
587
|
+
var l = fnMap.length;
|
|
588
|
+
var ret = {};
|
|
589
|
+
for (; i < l; i++) {
|
|
590
|
+
val = fnMap[i];
|
|
591
|
+
if (val && val[1] in document2) {
|
|
592
|
+
for (i = 0; i < val.length; i++) {
|
|
593
|
+
ret[fnMap[0][i]] = val[i];
|
|
594
|
+
}
|
|
595
|
+
return ret;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return false;
|
|
599
|
+
}();
|
|
600
|
+
var eventNameMap = {
|
|
601
|
+
change: fn.fullscreenchange,
|
|
602
|
+
error: fn.fullscreenerror
|
|
603
|
+
};
|
|
604
|
+
var screenfull2 = {
|
|
605
|
+
request: function(element, options) {
|
|
606
|
+
return new Promise(function(resolve, reject) {
|
|
607
|
+
var onFullScreenEntered = function() {
|
|
608
|
+
this.off("change", onFullScreenEntered);
|
|
609
|
+
resolve();
|
|
610
|
+
}.bind(this);
|
|
611
|
+
this.on("change", onFullScreenEntered);
|
|
612
|
+
element = element || document2.documentElement;
|
|
613
|
+
var returnPromise = element[fn.requestFullscreen](options);
|
|
614
|
+
if (returnPromise instanceof Promise) {
|
|
615
|
+
returnPromise.then(onFullScreenEntered).catch(reject);
|
|
616
|
+
}
|
|
617
|
+
}.bind(this));
|
|
618
|
+
},
|
|
619
|
+
exit: function() {
|
|
620
|
+
return new Promise(function(resolve, reject) {
|
|
621
|
+
if (!this.isFullscreen) {
|
|
622
|
+
resolve();
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
var onFullScreenExit = function() {
|
|
626
|
+
this.off("change", onFullScreenExit);
|
|
627
|
+
resolve();
|
|
628
|
+
}.bind(this);
|
|
629
|
+
this.on("change", onFullScreenExit);
|
|
630
|
+
var returnPromise = document2[fn.exitFullscreen]();
|
|
631
|
+
if (returnPromise instanceof Promise) {
|
|
632
|
+
returnPromise.then(onFullScreenExit).catch(reject);
|
|
633
|
+
}
|
|
634
|
+
}.bind(this));
|
|
635
|
+
},
|
|
636
|
+
toggle: function(element, options) {
|
|
637
|
+
return this.isFullscreen ? this.exit() : this.request(element, options);
|
|
638
|
+
},
|
|
639
|
+
onchange: function(callback) {
|
|
640
|
+
this.on("change", callback);
|
|
641
|
+
},
|
|
642
|
+
onerror: function(callback) {
|
|
643
|
+
this.on("error", callback);
|
|
644
|
+
},
|
|
645
|
+
on: function(event, callback) {
|
|
646
|
+
var eventName = eventNameMap[event];
|
|
647
|
+
if (eventName) {
|
|
648
|
+
document2.addEventListener(eventName, callback, false);
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
off: function(event, callback) {
|
|
652
|
+
var eventName = eventNameMap[event];
|
|
653
|
+
if (eventName) {
|
|
654
|
+
document2.removeEventListener(eventName, callback, false);
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
raw: fn
|
|
658
|
+
};
|
|
659
|
+
if (!fn) {
|
|
660
|
+
if (isCommonjs) {
|
|
661
|
+
module2.exports = { isEnabled: false };
|
|
662
|
+
} else {
|
|
663
|
+
window.screenfull = { isEnabled: false };
|
|
664
|
+
}
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
Object.defineProperties(screenfull2, {
|
|
668
|
+
isFullscreen: {
|
|
669
|
+
get: function() {
|
|
670
|
+
return Boolean(document2[fn.fullscreenElement]);
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
element: {
|
|
674
|
+
enumerable: true,
|
|
675
|
+
get: function() {
|
|
676
|
+
return document2[fn.fullscreenElement];
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
isEnabled: {
|
|
680
|
+
enumerable: true,
|
|
681
|
+
get: function() {
|
|
682
|
+
return Boolean(document2[fn.fullscreenEnabled]);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
if (isCommonjs) {
|
|
687
|
+
module2.exports = screenfull2;
|
|
688
|
+
} else {
|
|
689
|
+
window.screenfull = screenfull2;
|
|
690
|
+
}
|
|
691
|
+
})();
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
|
|
532
695
|
// src/index.ts
|
|
533
696
|
var src_exports = {};
|
|
534
697
|
__export(src_exports, {
|
|
@@ -854,8 +1017,8 @@ function isReference(block) {
|
|
|
854
1017
|
}
|
|
855
1018
|
|
|
856
1019
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
857
|
-
var
|
|
858
|
-
var
|
|
1020
|
+
var import_react42 = require("react");
|
|
1021
|
+
var import_react_intl34 = require("react-intl");
|
|
859
1022
|
|
|
860
1023
|
// src/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
861
1024
|
var import_react2 = require("react");
|
|
@@ -1713,6 +1876,30 @@ var isNullableArrayModel = (model) => {
|
|
|
1713
1876
|
// src/common/utils/misc-utils.ts
|
|
1714
1877
|
var isBasicError = (error) => isString(error) || isNull(error);
|
|
1715
1878
|
|
|
1879
|
+
// src/common/utils/mobile-utils.ts
|
|
1880
|
+
var isMobile = () => {
|
|
1881
|
+
return isMobileScreenSize() && (isTouchScreen() || isMobileUA());
|
|
1882
|
+
};
|
|
1883
|
+
var isMobileUA = (userAgent = window.navigator.userAgent) => {
|
|
1884
|
+
return /Mobi|\b(iPhone|Android|BlackBerry|webOS|Windows Phone)\b/i.test(userAgent);
|
|
1885
|
+
};
|
|
1886
|
+
var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => {
|
|
1887
|
+
return width < 768 || height < 768;
|
|
1888
|
+
};
|
|
1889
|
+
var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
|
|
1890
|
+
if ("maxTouchPoints" in navigator2) {
|
|
1891
|
+
return navigator2.maxTouchPoints > 0;
|
|
1892
|
+
}
|
|
1893
|
+
if ("msMaxTouchPoints" in navigator2) {
|
|
1894
|
+
return navigator2["msMaxTouchPoints"] > 0;
|
|
1895
|
+
}
|
|
1896
|
+
const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
|
|
1897
|
+
if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
|
|
1898
|
+
return !!mQ.matches;
|
|
1899
|
+
}
|
|
1900
|
+
return false;
|
|
1901
|
+
};
|
|
1902
|
+
|
|
1716
1903
|
// src/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1717
1904
|
var import_react6 = require("react");
|
|
1718
1905
|
function useDebouncedFunction(callback, waitMs) {
|
|
@@ -4758,99 +4945,69 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
4758
4945
|
return false;
|
|
4759
4946
|
};
|
|
4760
4947
|
|
|
4761
|
-
// src/jsonSchemaForm/JsonSchemaForm.tsx
|
|
4762
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4763
|
-
var JsonSchemaForm = (props) => {
|
|
4764
|
-
const schemaProps = __spreadValues({
|
|
4765
|
-
model: null,
|
|
4766
|
-
errors: null,
|
|
4767
|
-
disabled: false,
|
|
4768
|
-
baseUrl: ""
|
|
4769
|
-
}, props);
|
|
4770
|
-
if (useHasHttpClientProvider() || schemaProps.baseUrl == null) {
|
|
4771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GenericSchema_default, __spreadValues({}, schemaProps));
|
|
4772
|
-
}
|
|
4773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4774
|
-
Providers,
|
|
4775
|
-
{
|
|
4776
|
-
baseUrl: schemaProps.baseUrl,
|
|
4777
|
-
onEvent: schemaProps.onEvent,
|
|
4778
|
-
onLog: schemaProps.onLog,
|
|
4779
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GenericSchema_default, __spreadValues({}, schemaProps))
|
|
4780
|
-
}
|
|
4781
|
-
);
|
|
4782
|
-
};
|
|
4783
|
-
var JsonSchemaForm_default = JsonSchemaForm;
|
|
4784
|
-
var Providers = ({ baseUrl, onEvent, onLog, children }) => {
|
|
4785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog != null ? onLog : noop2, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4786
|
-
EventsContextProvider,
|
|
4787
|
-
{
|
|
4788
|
-
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
4789
|
-
onEvent: onEvent != null ? onEvent : noop2,
|
|
4790
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children })
|
|
4791
|
-
}
|
|
4792
|
-
) });
|
|
4793
|
-
};
|
|
4794
|
-
var noop2 = () => {
|
|
4795
|
-
};
|
|
4796
|
-
|
|
4797
4948
|
// src/layout/form/DynamicForm.tsx
|
|
4798
|
-
var
|
|
4799
|
-
var DynamicForm = (
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4949
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4950
|
+
var DynamicForm = ({
|
|
4951
|
+
component,
|
|
4952
|
+
model = null,
|
|
4953
|
+
errors = null,
|
|
4954
|
+
submitted,
|
|
4955
|
+
onModelChange,
|
|
4956
|
+
onPersistAsync
|
|
4957
|
+
}) => {
|
|
4958
|
+
const formSchema = component.schema;
|
|
4959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: getMargin(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4960
|
+
GenericSchema_default,
|
|
4804
4961
|
{
|
|
4805
4962
|
schema: formSchema,
|
|
4806
|
-
model
|
|
4807
|
-
|
|
4808
|
-
|
|
4963
|
+
model,
|
|
4964
|
+
errors,
|
|
4965
|
+
submitted,
|
|
4809
4966
|
onChange: (parameters) => {
|
|
4810
|
-
|
|
4967
|
+
onModelChange(__spreadValues({ formSchema }, parameters));
|
|
4811
4968
|
},
|
|
4812
|
-
onPersistAsync
|
|
4969
|
+
onPersistAsync
|
|
4813
4970
|
}
|
|
4814
4971
|
) });
|
|
4815
4972
|
};
|
|
4816
4973
|
var DynamicForm_default = DynamicForm;
|
|
4817
4974
|
|
|
4818
4975
|
// src/layout/heading/DynamicHeading.tsx
|
|
4819
|
-
var
|
|
4976
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4820
4977
|
var DynamicHeading = (props) => {
|
|
4821
4978
|
const { text, size = "md", align = "left", margin = "md" } = props.component;
|
|
4822
4979
|
const classes = getTextAlignmentAndMargin({ align, margin });
|
|
4823
4980
|
switch (size) {
|
|
4824
4981
|
case "xs":
|
|
4825
|
-
return /* @__PURE__ */ (0,
|
|
4982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h5", { className: classes, children: text });
|
|
4826
4983
|
case "sm":
|
|
4827
|
-
return /* @__PURE__ */ (0,
|
|
4984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h4", { className: classes, children: text });
|
|
4828
4985
|
case "lg":
|
|
4829
|
-
return /* @__PURE__ */ (0,
|
|
4986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h2", { className: classes, children: text });
|
|
4830
4987
|
case "xl":
|
|
4831
|
-
return /* @__PURE__ */ (0,
|
|
4988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h1", { className: classes, children: text });
|
|
4832
4989
|
case "md":
|
|
4833
4990
|
default:
|
|
4834
|
-
return /* @__PURE__ */ (0,
|
|
4991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h3", { className: classes, children: text });
|
|
4835
4992
|
}
|
|
4836
4993
|
};
|
|
4837
4994
|
var DynamicHeading_default = DynamicHeading;
|
|
4838
4995
|
|
|
4839
4996
|
// src/layout/markdown/DynamicMarkdown.tsx
|
|
4840
4997
|
var import_components17 = require("@transferwise/components");
|
|
4841
|
-
var
|
|
4998
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4842
4999
|
var DynamicMarkdown = ({ component }) => {
|
|
4843
5000
|
const { content, align, margin } = component;
|
|
4844
|
-
return /* @__PURE__ */ (0,
|
|
5001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
4845
5002
|
};
|
|
4846
5003
|
var DynamicInfo = ({ component }) => {
|
|
4847
|
-
return /* @__PURE__ */ (0,
|
|
5004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
4848
5005
|
};
|
|
4849
5006
|
|
|
4850
5007
|
// src/layout/image/DynamicImage.tsx
|
|
4851
5008
|
var import_components18 = require("@transferwise/components");
|
|
4852
5009
|
var import_react23 = require("react");
|
|
4853
|
-
var
|
|
5010
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4854
5011
|
var DynamicImage = ({ component: image }) => {
|
|
4855
5012
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
4856
5013
|
const httpClient = useHttpClient();
|
|
@@ -4867,7 +5024,7 @@ var DynamicImage = ({ component: image }) => {
|
|
|
4867
5024
|
if (!imageSource) {
|
|
4868
5025
|
return null;
|
|
4869
5026
|
}
|
|
4870
|
-
return /* @__PURE__ */ (0,
|
|
5027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components18.Image, __spreadValues({ className: `img-responsive ${getMargin(margin || "md")}` }, imageProps)) });
|
|
4871
5028
|
};
|
|
4872
5029
|
var readImageBlobAsDataURL = (imageBlob) => {
|
|
4873
5030
|
return new Promise((resolve, reject) => {
|
|
@@ -4901,47 +5058,47 @@ var DynamicImage_default = DynamicImage;
|
|
|
4901
5058
|
|
|
4902
5059
|
// src/layout/instructions/DynamicInstructions.tsx
|
|
4903
5060
|
var import_components19 = require("@transferwise/components");
|
|
4904
|
-
var
|
|
5061
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4905
5062
|
var doContext = ["positive", "neutral"];
|
|
4906
5063
|
var dontContext = ["warning", "negative"];
|
|
4907
5064
|
var DynamicInstructions = ({ component }) => {
|
|
4908
5065
|
const { items } = component;
|
|
4909
5066
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
4910
5067
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
4911
|
-
return /* @__PURE__ */ (0,
|
|
4912
|
-
component.title ? /* @__PURE__ */ (0,
|
|
4913
|
-
/* @__PURE__ */ (0,
|
|
5068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5069
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components19.Header, { title: component.title }) : null,
|
|
5070
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components19.InstructionsList, { dos, donts })
|
|
4914
5071
|
] });
|
|
4915
5072
|
};
|
|
4916
5073
|
var DynamicInstructions_default = DynamicInstructions;
|
|
4917
5074
|
|
|
4918
5075
|
// src/layout/DynamicLayout.tsx
|
|
4919
|
-
var
|
|
5076
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4920
5077
|
var getKey = (component) => JSON.stringify(component);
|
|
4921
5078
|
var DynamicLayout = (props) => {
|
|
4922
5079
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
4923
5080
|
const renderComponent = (component) => {
|
|
4924
5081
|
switch (component.type) {
|
|
4925
5082
|
case "heading":
|
|
4926
|
-
return /* @__PURE__ */ (0,
|
|
5083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
4927
5084
|
case "paragraph":
|
|
4928
|
-
return /* @__PURE__ */ (0,
|
|
5085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
4929
5086
|
case "image":
|
|
4930
|
-
return /* @__PURE__ */ (0,
|
|
5087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
4931
5088
|
case "alert":
|
|
4932
|
-
return /* @__PURE__ */ (0,
|
|
5089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
4933
5090
|
case "review":
|
|
4934
|
-
return /* @__PURE__ */ (0,
|
|
5091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
4935
5092
|
case "divider":
|
|
4936
|
-
return /* @__PURE__ */ (0,
|
|
5093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
4937
5094
|
case "info":
|
|
4938
|
-
return /* @__PURE__ */ (0,
|
|
5095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicInfo, { component }, getKey(component));
|
|
4939
5096
|
case "instructions":
|
|
4940
|
-
return /* @__PURE__ */ (0,
|
|
5097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
4941
5098
|
case "markdown":
|
|
4942
|
-
return /* @__PURE__ */ (0,
|
|
5099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
4943
5100
|
case "columns":
|
|
4944
|
-
return /* @__PURE__ */ (0,
|
|
5101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4945
5102
|
DynamicColumns_default,
|
|
4946
5103
|
{
|
|
4947
5104
|
component,
|
|
@@ -4955,7 +5112,7 @@ var DynamicLayout = (props) => {
|
|
|
4955
5112
|
getKey(component)
|
|
4956
5113
|
);
|
|
4957
5114
|
case "form":
|
|
4958
|
-
return /* @__PURE__ */ (0,
|
|
5115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4959
5116
|
DynamicForm_default,
|
|
4960
5117
|
{
|
|
4961
5118
|
component,
|
|
@@ -4968,9 +5125,9 @@ var DynamicLayout = (props) => {
|
|
|
4968
5125
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
4969
5126
|
);
|
|
4970
5127
|
case "button":
|
|
4971
|
-
return /* @__PURE__ */ (0,
|
|
5128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
4972
5129
|
case "box":
|
|
4973
|
-
return /* @__PURE__ */ (0,
|
|
5130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4974
5131
|
DynamicBox_default,
|
|
4975
5132
|
{
|
|
4976
5133
|
component,
|
|
@@ -4984,34 +5141,34 @@ var DynamicLayout = (props) => {
|
|
|
4984
5141
|
getKey(component)
|
|
4985
5142
|
);
|
|
4986
5143
|
case "decision":
|
|
4987
|
-
return /* @__PURE__ */ (0,
|
|
5144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
4988
5145
|
case "external":
|
|
4989
|
-
return /* @__PURE__ */ (0,
|
|
5146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
4990
5147
|
case "list":
|
|
4991
5148
|
case "status-list":
|
|
4992
|
-
return /* @__PURE__ */ (0,
|
|
5149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
4993
5150
|
case "loading-indicator":
|
|
4994
|
-
return /* @__PURE__ */ (0,
|
|
5151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
4995
5152
|
case "search":
|
|
4996
|
-
return /* @__PURE__ */ (0,
|
|
5153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
4997
5154
|
default:
|
|
4998
|
-
return /* @__PURE__ */ (0,
|
|
5155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", {}, getKey(component));
|
|
4999
5156
|
}
|
|
5000
5157
|
};
|
|
5001
5158
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
5002
|
-
return /* @__PURE__ */ (0,
|
|
5159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: components.map(renderComponent) });
|
|
5003
5160
|
} else {
|
|
5004
|
-
return /* @__PURE__ */ (0,
|
|
5161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5005
5162
|
}
|
|
5006
5163
|
};
|
|
5007
5164
|
var DynamicLayout_default = DynamicLayout;
|
|
5008
5165
|
|
|
5009
5166
|
// src/layout/list/DynamicStatusList.tsx
|
|
5010
5167
|
var import_components20 = require("@transferwise/components");
|
|
5011
|
-
var
|
|
5168
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5012
5169
|
var DynamicStatusList = ({ component }) => {
|
|
5013
|
-
return /* @__PURE__ */ (0,
|
|
5014
|
-
component.title ? /* @__PURE__ */ (0,
|
|
5170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5171
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("h4", { className: "m-b-2", children: [
|
|
5015
5172
|
" ",
|
|
5016
5173
|
component.title,
|
|
5017
5174
|
" "
|
|
@@ -5024,8 +5181,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
5024
5181
|
key: `${title}/${description || ""}`,
|
|
5025
5182
|
title,
|
|
5026
5183
|
description
|
|
5027
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
5028
|
-
return /* @__PURE__ */ (0,
|
|
5184
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
5185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_components20.Summary, __spreadValues({}, props));
|
|
5029
5186
|
};
|
|
5030
5187
|
var statusListMap = {
|
|
5031
5188
|
done: "done",
|
|
@@ -5042,10 +5199,10 @@ var DynamicStatusList_default = DynamicStatusList;
|
|
|
5042
5199
|
|
|
5043
5200
|
// src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5044
5201
|
var import_components21 = require("@transferwise/components");
|
|
5045
|
-
var
|
|
5202
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5046
5203
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
5047
5204
|
const { margin, size = "md" } = component;
|
|
5048
|
-
return /* @__PURE__ */ (0,
|
|
5205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5049
5206
|
import_components21.Loader,
|
|
5050
5207
|
{
|
|
5051
5208
|
size,
|
|
@@ -5082,15 +5239,15 @@ var import_components22 = require("@transferwise/components");
|
|
|
5082
5239
|
var import_react24 = require("react");
|
|
5083
5240
|
function useSnackBarIfAvailable() {
|
|
5084
5241
|
const context = (0, import_react24.useContext)(import_components22.SnackbarContext);
|
|
5085
|
-
return context ? context.createSnackbar :
|
|
5242
|
+
return context ? context.createSnackbar : noop2;
|
|
5086
5243
|
}
|
|
5087
|
-
function
|
|
5244
|
+
function noop2() {
|
|
5088
5245
|
}
|
|
5089
5246
|
|
|
5090
5247
|
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5091
|
-
var
|
|
5092
|
-
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
5093
|
-
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0,
|
|
5248
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5249
|
+
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BasicDynamicParagraph, { component });
|
|
5250
|
+
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
5094
5251
|
" ",
|
|
5095
5252
|
component.text,
|
|
5096
5253
|
" "
|
|
@@ -5101,11 +5258,11 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5101
5258
|
const { text } = component;
|
|
5102
5259
|
const copy = () => {
|
|
5103
5260
|
var _a;
|
|
5104
|
-
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(
|
|
5261
|
+
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop3);
|
|
5105
5262
|
};
|
|
5106
5263
|
const classNames7 = getTextAlignmentAndMargin({ align: component.align }) + " form-control";
|
|
5107
|
-
return /* @__PURE__ */ (0,
|
|
5108
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5109
5266
|
"input",
|
|
5110
5267
|
{
|
|
5111
5268
|
type: "text",
|
|
@@ -5115,16 +5272,16 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5115
5272
|
style: { textOverflow: "ellipsis" }
|
|
5116
5273
|
}
|
|
5117
5274
|
),
|
|
5118
|
-
/* @__PURE__ */ (0,
|
|
5275
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components23.Button, { block: true, onClick: copy, className: getMargin("sm"), children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5119
5276
|
] });
|
|
5120
5277
|
};
|
|
5121
|
-
function
|
|
5278
|
+
function noop3() {
|
|
5122
5279
|
}
|
|
5123
5280
|
var DynamicParagraph_default = DynamicParagraph;
|
|
5124
5281
|
|
|
5125
5282
|
// src/layout/review/DynamicReview.tsx
|
|
5126
5283
|
var import_components24 = require("@transferwise/components");
|
|
5127
|
-
var
|
|
5284
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5128
5285
|
var getDefinitions = (orientation, review) => {
|
|
5129
5286
|
return review.fields.map(
|
|
5130
5287
|
({ label, value, help }, index) => {
|
|
@@ -5138,14 +5295,14 @@ var getDefinitions = (orientation, review) => {
|
|
|
5138
5295
|
};
|
|
5139
5296
|
var getFieldValue = (value, help, orientation) => {
|
|
5140
5297
|
if (help) {
|
|
5141
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
5142
|
-
/* @__PURE__ */ (0,
|
|
5298
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Help_default, { help }),
|
|
5143
5300
|
" ",
|
|
5144
5301
|
value
|
|
5145
|
-
] }) : /* @__PURE__ */ (0,
|
|
5302
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
5146
5303
|
value,
|
|
5147
5304
|
" ",
|
|
5148
|
-
/* @__PURE__ */ (0,
|
|
5305
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Help_default, { help })
|
|
5149
5306
|
] });
|
|
5150
5307
|
}
|
|
5151
5308
|
return value;
|
|
@@ -5158,7 +5315,7 @@ var DynamicReview = (props) => {
|
|
|
5158
5315
|
const review = props.component;
|
|
5159
5316
|
const margin = getMargin(review.margin || "xs");
|
|
5160
5317
|
const getReviewAction = (action) => {
|
|
5161
|
-
return /* @__PURE__ */ (0,
|
|
5318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5162
5319
|
"a",
|
|
5163
5320
|
{
|
|
5164
5321
|
href: action.url,
|
|
@@ -5173,12 +5330,12 @@ var DynamicReview = (props) => {
|
|
|
5173
5330
|
);
|
|
5174
5331
|
};
|
|
5175
5332
|
const orientation = getReviewLayout(review);
|
|
5176
|
-
return /* @__PURE__ */ (0,
|
|
5177
|
-
review.title && /* @__PURE__ */ (0,
|
|
5333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
5334
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("h6", { className: `m-b-2 ${margin}`, children: [
|
|
5178
5335
|
review.title,
|
|
5179
5336
|
review.action && getReviewAction(review.action)
|
|
5180
5337
|
] }),
|
|
5181
|
-
/* @__PURE__ */ (0,
|
|
5338
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: review.title ? "" : margin, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components24.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
5182
5339
|
] });
|
|
5183
5340
|
};
|
|
5184
5341
|
var DynamicReview_default = DynamicReview;
|
|
@@ -5188,11 +5345,11 @@ var import_react26 = require("react");
|
|
|
5188
5345
|
|
|
5189
5346
|
// src/layout/search/SearchInput.tsx
|
|
5190
5347
|
var import_components25 = require("@transferwise/components");
|
|
5191
|
-
var
|
|
5348
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5192
5349
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
5193
|
-
return /* @__PURE__ */ (0,
|
|
5350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "control-label d-inline", children: [
|
|
5194
5351
|
title,
|
|
5195
|
-
/* @__PURE__ */ (0,
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5196
5353
|
import_components25.Input,
|
|
5197
5354
|
{
|
|
5198
5355
|
type: "text",
|
|
@@ -5224,13 +5381,13 @@ var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
5224
5381
|
});
|
|
5225
5382
|
|
|
5226
5383
|
// src/layout/search/SearchResults.tsx
|
|
5227
|
-
var
|
|
5384
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5228
5385
|
var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
5229
5386
|
if (results.length === 0) {
|
|
5230
|
-
return /* @__PURE__ */ (0,
|
|
5387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
5231
5388
|
}
|
|
5232
|
-
return /* @__PURE__ */ (0,
|
|
5233
|
-
return /* @__PURE__ */ (0,
|
|
5389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components26.NavigationOptionsList, { children: results.map((result) => {
|
|
5390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5234
5391
|
import_components26.NavigationOption,
|
|
5235
5392
|
{
|
|
5236
5393
|
title: result.title,
|
|
@@ -5246,10 +5403,10 @@ var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
|
5246
5403
|
};
|
|
5247
5404
|
var ErrorResult = ({ onRetrySearch }) => {
|
|
5248
5405
|
const intl = (0, import_react_intl19.useIntl)();
|
|
5249
|
-
return /* @__PURE__ */ (0,
|
|
5406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "m-t-2", children: [
|
|
5250
5407
|
intl.formatMessage(ErrorBoundary_messages_default.errorAlert),
|
|
5251
5408
|
"\xA0",
|
|
5252
|
-
/* @__PURE__ */ (0,
|
|
5409
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5253
5410
|
"a",
|
|
5254
5411
|
{
|
|
5255
5412
|
href: "/",
|
|
@@ -5335,7 +5492,7 @@ var addQueryParameter = (url, key, value) => {
|
|
|
5335
5492
|
};
|
|
5336
5493
|
|
|
5337
5494
|
// src/layout/search/DynamicSearch.tsx
|
|
5338
|
-
var
|
|
5495
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5339
5496
|
var DEBOUNCE_TIME = 400;
|
|
5340
5497
|
var DynamicSearch = ({ component, onAction }) => {
|
|
5341
5498
|
const [query, setQuery] = (0, import_react26.useState)("");
|
|
@@ -5369,17 +5526,17 @@ var DynamicSearch = ({ component, onAction }) => {
|
|
|
5369
5526
|
setQuery(query);
|
|
5370
5527
|
void search(query);
|
|
5371
5528
|
};
|
|
5372
|
-
return /* @__PURE__ */ (0,
|
|
5373
|
-
/* @__PURE__ */ (0,
|
|
5374
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
5375
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
5376
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
5529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: getMargin(margin), children: [
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
5531
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
5532
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ErrorResult, { onRetrySearch }),
|
|
5533
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
5377
5534
|
] });
|
|
5378
5535
|
};
|
|
5379
5536
|
var DynamicSearch_default = DynamicSearch;
|
|
5380
5537
|
|
|
5381
5538
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
5382
|
-
var
|
|
5539
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5383
5540
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
5384
5541
|
var getDefaultValue = (schema) => {
|
|
5385
5542
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -5454,15 +5611,15 @@ var BasicTypeSchema = (props) => {
|
|
|
5454
5611
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5455
5612
|
const schemaHelp = props.schema.help;
|
|
5456
5613
|
const feedbackId = `${id}-feedback`;
|
|
5457
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
5458
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
5459
|
-
/* @__PURE__ */ (0,
|
|
5460
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5461
|
-
/* @__PURE__ */ (0,
|
|
5462
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
5614
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5615
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
5616
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
5617
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "d-inline-block", children: [
|
|
5618
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
5619
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Help_default, { help: schemaHelp })
|
|
5463
5620
|
] }),
|
|
5464
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
5465
|
-
/* @__PURE__ */ (0,
|
|
5621
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Help_default, { help: schemaHelp }),
|
|
5622
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5466
5623
|
SchemaFormControl_default,
|
|
5467
5624
|
{
|
|
5468
5625
|
id,
|
|
@@ -5475,7 +5632,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5475
5632
|
describedBy: feedbackId
|
|
5476
5633
|
}
|
|
5477
5634
|
),
|
|
5478
|
-
/* @__PURE__ */ (0,
|
|
5635
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5479
5636
|
ControlFeedback_default,
|
|
5480
5637
|
{
|
|
5481
5638
|
id: feedbackId,
|
|
@@ -5500,7 +5657,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
5500
5657
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
5501
5658
|
|
|
5502
5659
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5503
|
-
var
|
|
5660
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5504
5661
|
var getIdFromResponse = (idProperty, response) => {
|
|
5505
5662
|
return response[idProperty];
|
|
5506
5663
|
};
|
|
@@ -5592,7 +5749,7 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5592
5749
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
5593
5750
|
}
|
|
5594
5751
|
};
|
|
5595
|
-
return /* @__PURE__ */ (0,
|
|
5752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5596
5753
|
BasicTypeSchema_default,
|
|
5597
5754
|
{
|
|
5598
5755
|
required,
|
|
@@ -5803,7 +5960,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5803
5960
|
}
|
|
5804
5961
|
|
|
5805
5962
|
// src/step/layoutStep/LayoutStep.tsx
|
|
5806
|
-
var
|
|
5963
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5807
5964
|
var getComponents = (step, options) => {
|
|
5808
5965
|
var _a;
|
|
5809
5966
|
if (isEmpty(step)) {
|
|
@@ -5826,7 +5983,7 @@ var LayoutStep = (props) => {
|
|
|
5826
5983
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
5827
5984
|
};
|
|
5828
5985
|
useStepPolling(stepSpecification.polling, onAction);
|
|
5829
|
-
return /* @__PURE__ */ (0,
|
|
5986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5830
5987
|
DynamicLayout_default,
|
|
5831
5988
|
{
|
|
5832
5989
|
components,
|
|
@@ -5842,11 +5999,11 @@ var LayoutStep = (props) => {
|
|
|
5842
5999
|
var LayoutStep_default = LayoutStep;
|
|
5843
6000
|
|
|
5844
6001
|
// src/step/cameraStep/CameraStep.tsx
|
|
5845
|
-
var
|
|
6002
|
+
var import_react37 = require("react");
|
|
5846
6003
|
|
|
5847
6004
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
5848
|
-
var
|
|
5849
|
-
var
|
|
6005
|
+
var import_react36 = require("react");
|
|
6006
|
+
var import_react_intl30 = require("react-intl");
|
|
5850
6007
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
5851
6008
|
|
|
5852
6009
|
// src/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
@@ -5871,14 +6028,54 @@ var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
|
5871
6028
|
|
|
5872
6029
|
// src/step/cameraStep/cameraCapture/components/index.tsx
|
|
5873
6030
|
var import_components27 = require("@transferwise/components");
|
|
6031
|
+
var import_react_intl25 = require("react-intl");
|
|
6032
|
+
|
|
6033
|
+
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6034
|
+
var import_react_intl24 = require("react-intl");
|
|
6035
|
+
|
|
6036
|
+
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
5874
6037
|
var import_react_intl23 = require("react-intl");
|
|
6038
|
+
var OrientationLockOverlay_messages_default = (0, import_react_intl23.defineMessages)({
|
|
6039
|
+
text: {
|
|
6040
|
+
id: "dynamicFlows.CameraCapture.rotatePhone.text",
|
|
6041
|
+
defaultMessage: "Rotate your phone to portrait view to take a photo",
|
|
6042
|
+
description: "Prompt the user to rotate their phone from landscape to portrait mode when attempting to take a photo"
|
|
6043
|
+
},
|
|
6044
|
+
imgAlt: {
|
|
6045
|
+
id: "dynamicFlows.CameraCapture.rotatePhone.imgAlt",
|
|
6046
|
+
defaultMessage: "Rotate your phone icon",
|
|
6047
|
+
description: "Rotate phone icon alt text"
|
|
6048
|
+
}
|
|
6049
|
+
});
|
|
6050
|
+
|
|
6051
|
+
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6052
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6053
|
+
var OrientationLockOverlay = () => {
|
|
6054
|
+
const intl = (0, import_react_intl24.useIntl)();
|
|
6055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "orientation-lock-overlay p-x-3 p-y-3", "data-testid": "orientation-lock", children: [
|
|
6056
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6057
|
+
"img",
|
|
6058
|
+
{
|
|
6059
|
+
className: "m-b-3",
|
|
6060
|
+
src: "https://wise.com/public-resources/assets/camera-guidelines/icon-rotate-phone.svg",
|
|
6061
|
+
width: "96",
|
|
6062
|
+
height: "96",
|
|
6063
|
+
alt: intl.formatMessage(OrientationLockOverlay_messages_default.imgAlt)
|
|
6064
|
+
}
|
|
6065
|
+
),
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
6067
|
+
] });
|
|
6068
|
+
};
|
|
6069
|
+
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
6070
|
+
|
|
6071
|
+
// src/step/cameraStep/cameraCapture/components/index.tsx
|
|
5875
6072
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5876
6073
|
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
5877
6074
|
var ReviewBottomBar = ({
|
|
5878
6075
|
onSubmit,
|
|
5879
6076
|
onRetry
|
|
5880
6077
|
}) => {
|
|
5881
|
-
const intl = (0,
|
|
6078
|
+
const intl = (0, import_react_intl25.useIntl)();
|
|
5882
6079
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
5883
6080
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5884
6081
|
import_components27.Button,
|
|
@@ -5916,8 +6113,52 @@ var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime57.js
|
|
|
5916
6113
|
}
|
|
5917
6114
|
);
|
|
5918
6115
|
|
|
5919
|
-
// src/step/cameraStep/cameraCapture/hooks/
|
|
6116
|
+
// src/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
5920
6117
|
var import_react33 = require("react");
|
|
6118
|
+
var import_screenfull = __toESM(require_screenfull());
|
|
6119
|
+
var useFullScreenOrientationLock = (isMobile2) => {
|
|
6120
|
+
const lockOrientation = (0, import_react33.useCallback)(() => {
|
|
6121
|
+
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
6122
|
+
window.screen.orientation.lock("portrait").catch((e) => {
|
|
6123
|
+
});
|
|
6124
|
+
}
|
|
6125
|
+
}, []);
|
|
6126
|
+
const unlockOrientation = (0, import_react33.useCallback)(() => {
|
|
6127
|
+
var _a, _b;
|
|
6128
|
+
if ((_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) {
|
|
6129
|
+
window.screen.orientation.unlock();
|
|
6130
|
+
}
|
|
6131
|
+
}, []);
|
|
6132
|
+
const enterFullScreen = (0, import_react33.useCallback)(() => {
|
|
6133
|
+
setTimeout(() => {
|
|
6134
|
+
if (isMobile2 && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
6135
|
+
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
6136
|
+
lockOrientation();
|
|
6137
|
+
}).catch((e) => {
|
|
6138
|
+
});
|
|
6139
|
+
}
|
|
6140
|
+
}, 100);
|
|
6141
|
+
}, [isMobile2, lockOrientation]);
|
|
6142
|
+
const exitFullScreen = (0, import_react33.useCallback)(() => {
|
|
6143
|
+
if (import_screenfull.default.isFullscreen) {
|
|
6144
|
+
import_screenfull.default.exit().catch(() => {
|
|
6145
|
+
});
|
|
6146
|
+
}
|
|
6147
|
+
unlockOrientation();
|
|
6148
|
+
}, [unlockOrientation]);
|
|
6149
|
+
(0, import_react33.useEffect)(() => {
|
|
6150
|
+
return () => {
|
|
6151
|
+
exitFullScreen();
|
|
6152
|
+
};
|
|
6153
|
+
}, [exitFullScreen]);
|
|
6154
|
+
return {
|
|
6155
|
+
enterFullScreen,
|
|
6156
|
+
exitFullScreen
|
|
6157
|
+
};
|
|
6158
|
+
};
|
|
6159
|
+
|
|
6160
|
+
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6161
|
+
var import_react34 = require("react");
|
|
5921
6162
|
|
|
5922
6163
|
// src/step/cameraStep/cameraCapture/utils/index.ts
|
|
5923
6164
|
var isSelfieCamera = (stream) => {
|
|
@@ -5963,9 +6204,9 @@ var getVideoCapabilities = (videoStream) => {
|
|
|
5963
6204
|
return (_b = (_a = getVideoTrack(videoStream)) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
|
|
5964
6205
|
};
|
|
5965
6206
|
|
|
5966
|
-
// src/step/cameraStep/cameraCapture/hooks/
|
|
6207
|
+
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
5967
6208
|
var useVideoConstraints = (direction) => {
|
|
5968
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
6209
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react34.useState)();
|
|
5969
6210
|
const defaultVideoConstraints = {
|
|
5970
6211
|
facingMode: direction === "front" ? "user" : "environment",
|
|
5971
6212
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -5973,7 +6214,7 @@ var useVideoConstraints = (direction) => {
|
|
|
5973
6214
|
frameRate: 30,
|
|
5974
6215
|
aspectRatio: 16 / 9
|
|
5975
6216
|
};
|
|
5976
|
-
(0,
|
|
6217
|
+
(0, import_react34.useEffect)(() => {
|
|
5977
6218
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
5978
6219
|
}, [direction]);
|
|
5979
6220
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -5991,7 +6232,7 @@ var useVideoConstraints = (direction) => {
|
|
|
5991
6232
|
};
|
|
5992
6233
|
|
|
5993
6234
|
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
5994
|
-
var
|
|
6235
|
+
var import_react35 = require("react");
|
|
5995
6236
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5996
6237
|
var captureButtonHeight = 92;
|
|
5997
6238
|
var reviewButtonsHeight = 120;
|
|
@@ -6008,8 +6249,8 @@ var Overlay = ({
|
|
|
6008
6249
|
instructions,
|
|
6009
6250
|
reviewInstructions
|
|
6010
6251
|
}) => {
|
|
6011
|
-
const svgReference = (0,
|
|
6012
|
-
(0,
|
|
6252
|
+
const svgReference = (0, import_react35.useRef)(null);
|
|
6253
|
+
(0, import_react35.useEffect)(() => {
|
|
6013
6254
|
const listener = debounce(() => {
|
|
6014
6255
|
var _a;
|
|
6015
6256
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -6064,11 +6305,11 @@ var Overlay_default = Overlay;
|
|
|
6064
6305
|
|
|
6065
6306
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6066
6307
|
var import_components28 = require("@transferwise/components");
|
|
6067
|
-
var
|
|
6308
|
+
var import_react_intl27 = require("react-intl");
|
|
6068
6309
|
|
|
6069
6310
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.ts
|
|
6070
|
-
var
|
|
6071
|
-
var NoCameraAccess_messages_default = (0,
|
|
6311
|
+
var import_react_intl26 = require("react-intl");
|
|
6312
|
+
var NoCameraAccess_messages_default = (0, import_react_intl26.defineMessages)({
|
|
6072
6313
|
title: {
|
|
6073
6314
|
id: "dynamicFlows.CameraCapture.NoCameraAccess.title",
|
|
6074
6315
|
defaultMessage: "We can't access your camera",
|
|
@@ -6089,7 +6330,7 @@ var NoCameraAccess_messages_default = (0, import_react_intl24.defineMessages)({
|
|
|
6089
6330
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6090
6331
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6091
6332
|
var NoCameraAccess = ({ onAction }) => {
|
|
6092
|
-
const intl = (0,
|
|
6333
|
+
const intl = (0, import_react_intl27.useIntl)();
|
|
6093
6334
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6094
6335
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
6095
6336
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
@@ -6099,11 +6340,11 @@ var NoCameraAccess = ({ onAction }) => {
|
|
|
6099
6340
|
var NoCameraAccess_default = NoCameraAccess;
|
|
6100
6341
|
|
|
6101
6342
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6102
|
-
var
|
|
6343
|
+
var import_react_intl29 = require("react-intl");
|
|
6103
6344
|
|
|
6104
6345
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.ts
|
|
6105
|
-
var
|
|
6106
|
-
var CameraNotSupported_messages_default = (0,
|
|
6346
|
+
var import_react_intl28 = require("react-intl");
|
|
6347
|
+
var CameraNotSupported_messages_default = (0, import_react_intl28.defineMessages)({
|
|
6107
6348
|
title: {
|
|
6108
6349
|
id: "dynamicFlows.CameraCapture.CameraNotSupported.title",
|
|
6109
6350
|
defaultMessage: "Camera not supported",
|
|
@@ -6119,7 +6360,7 @@ var CameraNotSupported_messages_default = (0, import_react_intl26.defineMessages
|
|
|
6119
6360
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6120
6361
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6121
6362
|
var CameraNotSupported = () => {
|
|
6122
|
-
const intl = (0,
|
|
6363
|
+
const intl = (0, import_react_intl29.useIntl)();
|
|
6123
6364
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6124
6365
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
6125
6366
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
@@ -6159,14 +6400,16 @@ var CameraCapture = ({
|
|
|
6159
6400
|
onCapture,
|
|
6160
6401
|
onEvent
|
|
6161
6402
|
}) => {
|
|
6162
|
-
const [mode, setMode] = (0,
|
|
6163
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
6164
|
-
const [ready, setReady] = (0,
|
|
6165
|
-
const [reviewImage, setReviewImage] = (0,
|
|
6166
|
-
const webcamReference = (0,
|
|
6403
|
+
const [mode, setMode] = (0, import_react36.useState)("CAPTURE");
|
|
6404
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react36.useState)(false);
|
|
6405
|
+
const [ready, setReady] = (0, import_react36.useState)(false);
|
|
6406
|
+
const [reviewImage, setReviewImage] = (0, import_react36.useState)();
|
|
6407
|
+
const webcamReference = (0, import_react36.useRef)(null);
|
|
6167
6408
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6168
|
-
const
|
|
6169
|
-
const
|
|
6409
|
+
const isMobileDevice = (0, import_react36.useMemo)(() => isMobile(), []);
|
|
6410
|
+
const { enterFullScreen, exitFullScreen } = useFullScreenOrientationLock(isMobileDevice);
|
|
6411
|
+
const intl = (0, import_react_intl30.useIntl)();
|
|
6412
|
+
const handleCapture = (0, import_react36.useCallback)(async () => {
|
|
6170
6413
|
var _a, _b, _c, _d, _e, _f;
|
|
6171
6414
|
if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
|
|
6172
6415
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -6188,7 +6431,7 @@ var CameraCapture = ({
|
|
|
6188
6431
|
);
|
|
6189
6432
|
}
|
|
6190
6433
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
6191
|
-
const handleUserMediaError = (0,
|
|
6434
|
+
const handleUserMediaError = (0, import_react36.useCallback)(
|
|
6192
6435
|
(error) => {
|
|
6193
6436
|
if (error instanceof DOMException && (error == null ? void 0 : error.name) === "NotAllowedError") {
|
|
6194
6437
|
setMode("NO_CAMERA_ACCESS");
|
|
@@ -6200,13 +6443,14 @@ var CameraCapture = ({
|
|
|
6200
6443
|
},
|
|
6201
6444
|
[setMode, onEvent]
|
|
6202
6445
|
);
|
|
6203
|
-
const handleUserMedia = (0,
|
|
6446
|
+
const handleUserMedia = (0, import_react36.useCallback)(
|
|
6204
6447
|
(stream) => {
|
|
6448
|
+
enterFullScreen();
|
|
6205
6449
|
setReady(true);
|
|
6206
6450
|
setIsVideoMirrored(isSelfieCamera(stream));
|
|
6207
6451
|
void trackCameraFeedStarted(onEvent, { direction }, stream);
|
|
6208
6452
|
},
|
|
6209
|
-
[setIsVideoMirrored, onEvent, direction]
|
|
6453
|
+
[setIsVideoMirrored, onEvent, direction, enterFullScreen]
|
|
6210
6454
|
);
|
|
6211
6455
|
const handleReviewSubmit = () => {
|
|
6212
6456
|
onCapture((reviewImage == null ? void 0 : reviewImage.blob) || null);
|
|
@@ -6216,6 +6460,11 @@ var CameraCapture = ({
|
|
|
6216
6460
|
setReviewImage(void 0);
|
|
6217
6461
|
};
|
|
6218
6462
|
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
6463
|
+
(0, import_react36.useEffect)(() => {
|
|
6464
|
+
if (mode !== "CAPTURE") {
|
|
6465
|
+
exitFullScreen();
|
|
6466
|
+
}
|
|
6467
|
+
}, [mode, exitFullScreen]);
|
|
6219
6468
|
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
6220
6469
|
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6221
6470
|
import_react_webcam.default,
|
|
@@ -6238,6 +6487,7 @@ var CameraCapture = ({
|
|
|
6238
6487
|
instructions
|
|
6239
6488
|
}
|
|
6240
6489
|
),
|
|
6490
|
+
isMobileDevice && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(OrientationLockOverlay_default, {}),
|
|
6241
6491
|
ready && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
|
|
6242
6492
|
] });
|
|
6243
6493
|
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
@@ -6282,8 +6532,8 @@ var CameraStep = (props) => {
|
|
|
6282
6532
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
6283
6533
|
const { overlay, outline } = assets || {};
|
|
6284
6534
|
const { url: imageUrl } = image || {};
|
|
6285
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
6286
|
-
(0,
|
|
6535
|
+
const [captureClicked, setCaptureClicked] = (0, import_react37.useState)(false);
|
|
6536
|
+
(0, import_react37.useEffect)(() => {
|
|
6287
6537
|
if (captureClicked) {
|
|
6288
6538
|
onAction(action);
|
|
6289
6539
|
}
|
|
@@ -6351,11 +6601,11 @@ function getFirstAction(step) {
|
|
|
6351
6601
|
}
|
|
6352
6602
|
|
|
6353
6603
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6354
|
-
var
|
|
6604
|
+
var import_react_intl32 = require("react-intl");
|
|
6355
6605
|
|
|
6356
6606
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
|
|
6357
|
-
var
|
|
6358
|
-
var ExternalConfirmationStep_messages_default = (0,
|
|
6607
|
+
var import_react_intl31 = require("react-intl");
|
|
6608
|
+
var ExternalConfirmationStep_messages_default = (0, import_react_intl31.defineMessages)({
|
|
6359
6609
|
title: {
|
|
6360
6610
|
id: "dynamicFlows.ExternalConfirmation.title",
|
|
6361
6611
|
defaultMessage: "Please confirm",
|
|
@@ -6380,10 +6630,10 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl29.defineMe
|
|
|
6380
6630
|
|
|
6381
6631
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6382
6632
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6383
|
-
var
|
|
6633
|
+
var noop4 = () => {
|
|
6384
6634
|
};
|
|
6385
6635
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6386
|
-
const { formatMessage } = (0,
|
|
6636
|
+
const { formatMessage } = (0, import_react_intl32.useIntl)();
|
|
6387
6637
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6388
6638
|
DynamicLayout_default,
|
|
6389
6639
|
{
|
|
@@ -6434,8 +6684,8 @@ var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
|
6434
6684
|
}
|
|
6435
6685
|
onClose();
|
|
6436
6686
|
},
|
|
6437
|
-
onModelChange:
|
|
6438
|
-
onPersistAsync:
|
|
6687
|
+
onModelChange: noop4,
|
|
6688
|
+
onPersistAsync: noop4
|
|
6439
6689
|
}
|
|
6440
6690
|
);
|
|
6441
6691
|
};
|
|
@@ -6497,10 +6747,10 @@ var DynamicFlowStep = (props) => {
|
|
|
6497
6747
|
};
|
|
6498
6748
|
|
|
6499
6749
|
// src/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6500
|
-
var
|
|
6750
|
+
var import_react38 = require("react");
|
|
6501
6751
|
var DEBOUNCE_DELAY = 1e3;
|
|
6502
6752
|
function useDebouncedRefresh(fetchRefresh) {
|
|
6503
|
-
const map = (0,
|
|
6753
|
+
const map = (0, import_react38.useRef)(/* @__PURE__ */ new Map());
|
|
6504
6754
|
const retrieveOrCreate = (key) => {
|
|
6505
6755
|
if (map.current.has(key)) {
|
|
6506
6756
|
return map.current.get(key);
|
|
@@ -6523,12 +6773,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
6523
6773
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
6524
6774
|
|
|
6525
6775
|
// src/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6526
|
-
var
|
|
6776
|
+
var import_react39 = require("react");
|
|
6527
6777
|
var useDynamicFlowState = (initialStep) => {
|
|
6528
6778
|
var _a, _b;
|
|
6529
|
-
const [formErrors, setFormErrors] = (0,
|
|
6530
|
-
const [globalError, setGlobalError] = (0,
|
|
6531
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
6779
|
+
const [formErrors, setFormErrors] = (0, import_react39.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
6780
|
+
const [globalError, setGlobalError] = (0, import_react39.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
6781
|
+
const [stepAndModels, setStepAndModels] = (0, import_react39.useState)({
|
|
6532
6782
|
step: initialStep || void 0,
|
|
6533
6783
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
6534
6784
|
etag: void 0
|
|
@@ -6558,7 +6808,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6558
6808
|
return updatedState;
|
|
6559
6809
|
});
|
|
6560
6810
|
};
|
|
6561
|
-
const modelIsValid = (0,
|
|
6811
|
+
const modelIsValid = (0, import_react39.useMemo)(
|
|
6562
6812
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
6563
6813
|
[models, step]
|
|
6564
6814
|
);
|
|
@@ -6637,7 +6887,7 @@ var isInlineSchema = (schema) => {
|
|
|
6637
6887
|
|
|
6638
6888
|
// src/dynamicFlow/utils/useLoader.tsx
|
|
6639
6889
|
var import_components31 = require("@transferwise/components");
|
|
6640
|
-
var
|
|
6890
|
+
var import_react40 = require("react");
|
|
6641
6891
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6642
6892
|
function useLoader(loaderConfig, initialState) {
|
|
6643
6893
|
const config = __spreadValues({
|
|
@@ -6645,7 +6895,7 @@ function useLoader(loaderConfig, initialState) {
|
|
|
6645
6895
|
initial: true,
|
|
6646
6896
|
submission: false
|
|
6647
6897
|
}, loaderConfig);
|
|
6648
|
-
const [loadingState, setLoadingState] = (0,
|
|
6898
|
+
const [loadingState, setLoadingState] = (0, import_react40.useState)(initialState);
|
|
6649
6899
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
6650
6900
|
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6651
6901
|
import_components31.Loader,
|
|
@@ -6659,14 +6909,14 @@ function useLoader(loaderConfig, initialState) {
|
|
|
6659
6909
|
}
|
|
6660
6910
|
|
|
6661
6911
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6662
|
-
var
|
|
6912
|
+
var import_react41 = require("react");
|
|
6663
6913
|
|
|
6664
6914
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
|
|
6665
6915
|
var import_components32 = require("@transferwise/components");
|
|
6666
|
-
var
|
|
6916
|
+
var import_react_intl33 = require("react-intl");
|
|
6667
6917
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6668
6918
|
var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
6669
|
-
const { formatMessage } = (0,
|
|
6919
|
+
const { formatMessage } = (0, import_react_intl33.useIntl)();
|
|
6670
6920
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6671
6921
|
import_components32.Alert,
|
|
6672
6922
|
{
|
|
@@ -6684,9 +6934,9 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
|
6684
6934
|
|
|
6685
6935
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6686
6936
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6687
|
-
var
|
|
6937
|
+
var noop5 = () => {
|
|
6688
6938
|
};
|
|
6689
|
-
var ErrorBoundary = class extends
|
|
6939
|
+
var ErrorBoundary = class extends import_react41.Component {
|
|
6690
6940
|
constructor(props) {
|
|
6691
6941
|
super(props);
|
|
6692
6942
|
this.handleErrorReset = () => {
|
|
@@ -6698,7 +6948,7 @@ var ErrorBoundary = class extends import_react40.Component {
|
|
|
6698
6948
|
return { hasError: true, isFatalError: true };
|
|
6699
6949
|
}
|
|
6700
6950
|
componentDidCatch(error) {
|
|
6701
|
-
const { onError =
|
|
6951
|
+
const { onError = noop5 } = this.props;
|
|
6702
6952
|
onError(error);
|
|
6703
6953
|
}
|
|
6704
6954
|
render() {
|
|
@@ -6811,7 +7061,7 @@ var isResponse = (response) => typeof response === "object" && response !== null
|
|
|
6811
7061
|
|
|
6812
7062
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
6813
7063
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6814
|
-
var
|
|
7064
|
+
var noop6 = () => {
|
|
6815
7065
|
};
|
|
6816
7066
|
var DynamicFlowComponent = ({
|
|
6817
7067
|
flowId,
|
|
@@ -6822,10 +7072,10 @@ var DynamicFlowComponent = ({
|
|
|
6822
7072
|
displayStepTitle = true,
|
|
6823
7073
|
onCompletion,
|
|
6824
7074
|
onError,
|
|
6825
|
-
onEvent =
|
|
6826
|
-
onLog =
|
|
7075
|
+
onEvent = noop6,
|
|
7076
|
+
onLog = noop6
|
|
6827
7077
|
}) => {
|
|
6828
|
-
const { locale } = (0,
|
|
7078
|
+
const { locale } = (0, import_react_intl34.useIntl)();
|
|
6829
7079
|
const {
|
|
6830
7080
|
formErrors,
|
|
6831
7081
|
globalError,
|
|
@@ -6838,24 +7088,24 @@ var DynamicFlowComponent = ({
|
|
|
6838
7088
|
setStepAndEtag,
|
|
6839
7089
|
setSchemaModel
|
|
6840
7090
|
} = useDynamicFlowState(initialStep);
|
|
6841
|
-
const [submitted, setSubmitted] = (0,
|
|
7091
|
+
const [submitted, setSubmitted] = (0, import_react42.useState)(false);
|
|
6842
7092
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
6843
7093
|
loaderConfig,
|
|
6844
7094
|
initialStep ? "idle" : "initial"
|
|
6845
7095
|
);
|
|
6846
7096
|
const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
|
|
6847
|
-
const analyticsMetadata = (0,
|
|
7097
|
+
const analyticsMetadata = (0, import_react42.useMemo)(
|
|
6848
7098
|
() => {
|
|
6849
7099
|
var _a;
|
|
6850
7100
|
return __spreadValues({ flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key) }, (_a = step == null ? void 0 : step.analytics) != null ? _a : {});
|
|
6851
7101
|
},
|
|
6852
7102
|
[flowId, step]
|
|
6853
7103
|
);
|
|
6854
|
-
const dispatchEvent = (0,
|
|
7104
|
+
const dispatchEvent = (0, import_react42.useMemo)(
|
|
6855
7105
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
6856
7106
|
[onEvent, analyticsMetadata]
|
|
6857
7107
|
);
|
|
6858
|
-
const dfHttpClient = (0,
|
|
7108
|
+
const dfHttpClient = (0, import_react42.useCallback)(
|
|
6859
7109
|
({ action, data, etag: etag2 }) => {
|
|
6860
7110
|
const { url, method = "POST" } = action;
|
|
6861
7111
|
return httpClient(url != null ? url : "", {
|
|
@@ -6905,17 +7155,17 @@ var DynamicFlowComponent = ({
|
|
|
6905
7155
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
6906
7156
|
};
|
|
6907
7157
|
const debouncedRefresh = useDebouncedRefresh(performRefresh);
|
|
6908
|
-
const dispatchEventAndComplete = (0,
|
|
7158
|
+
const dispatchEventAndComplete = (0, import_react42.useCallback)(
|
|
6909
7159
|
(result) => {
|
|
6910
7160
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
6911
7161
|
onCompletion(result);
|
|
6912
7162
|
},
|
|
6913
7163
|
[onCompletion, dispatchEvent]
|
|
6914
7164
|
);
|
|
6915
|
-
(0,
|
|
7165
|
+
(0, import_react42.useEffect)(() => {
|
|
6916
7166
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
6917
7167
|
}, []);
|
|
6918
|
-
(0,
|
|
7168
|
+
(0, import_react42.useEffect)(() => {
|
|
6919
7169
|
if (!initialStep) {
|
|
6920
7170
|
const action = __spreadValues({
|
|
6921
7171
|
id: "#initial-step-request",
|
|
@@ -7063,6 +7313,27 @@ var shouldTriggerRefresh = (props) => {
|
|
|
7063
7313
|
return type !== "init" && hasRefreshOnChange && (isValid() || wasValid());
|
|
7064
7314
|
};
|
|
7065
7315
|
|
|
7316
|
+
// src/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7317
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7318
|
+
var JsonSchemaForm = (props) => {
|
|
7319
|
+
const schemaProps = __spreadValues({
|
|
7320
|
+
model: null,
|
|
7321
|
+
errors: null
|
|
7322
|
+
}, props);
|
|
7323
|
+
const { baseUrl = "", onEvent = noop7, onLog = noop7 } = props;
|
|
7324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7325
|
+
EventsContextProvider,
|
|
7326
|
+
{
|
|
7327
|
+
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
7328
|
+
onEvent,
|
|
7329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
7330
|
+
}
|
|
7331
|
+
) });
|
|
7332
|
+
};
|
|
7333
|
+
var JsonSchemaForm_default = JsonSchemaForm;
|
|
7334
|
+
var noop7 = () => {
|
|
7335
|
+
};
|
|
7336
|
+
|
|
7066
7337
|
// src/i18n/de.json
|
|
7067
7338
|
var de_default = {
|
|
7068
7339
|
"dynamicFlows.ArraySchema.addItem": "Speichern",
|
|
@@ -7123,6 +7394,8 @@ var en_default = {
|
|
|
7123
7394
|
"dynamicFlows.CameraCapture.reviewInstructions": "Is your picture clear, readable and complete?",
|
|
7124
7395
|
"dynamicFlows.CameraCapture.reviewRetry": "No, try again",
|
|
7125
7396
|
"dynamicFlows.CameraCapture.reviewSubmit": "Yes, submit",
|
|
7397
|
+
"dynamicFlows.CameraCapture.rotatePhone.imgAlt": "Rotate your phone icon",
|
|
7398
|
+
"dynamicFlows.CameraCapture.rotatePhone.text": "Rotate your phone to portrait view to take a photo",
|
|
7126
7399
|
"dynamicFlows.ControlFeedback.maxLength": "Please enter {maxLength} or fewer characters.",
|
|
7127
7400
|
"dynamicFlows.ControlFeedback.maximum": "Please enter a number that's {maximum} or less.",
|
|
7128
7401
|
"dynamicFlows.ControlFeedback.maximumDate": "Please enter a date that's on or before {maximum}.",
|
|
@@ -7246,7 +7519,7 @@ var hu_default = {
|
|
|
7246
7519
|
"dynamicFlows.ArraySchema.editItem": "Ment\xE9s",
|
|
7247
7520
|
"dynamicFlows.ArraySchema.maxItemsError": "K\xE9r\xFCnk, {maxItems} vagy ann\xE1l kevesebb t\xE9telt adj meg.",
|
|
7248
7521
|
"dynamicFlows.ArraySchema.minItemsError": "K\xE9r\xFCnk, legal\xE1bb {minItems} t\xE9telt adj meg.",
|
|
7249
|
-
"dynamicFlows.ArraySchema.removeItem": "Elt\xE1vol\xEDt\
|
|
7522
|
+
"dynamicFlows.ArraySchema.removeItem": "Elt\xE1vol\xEDt\xE1s",
|
|
7250
7523
|
"dynamicFlows.CameraCapture.CameraNotSupported.paragraph": "Az \xE1ltalad haszn\xE1lt b\xF6ng\xE9sz\u0151 nem t\xE1mogatja a kamera haszn\xE1lat\xE1t. K\xE9r\xFCnk, pr\xF3b\xE1lkozz m\xE1s b\xF6ng\xE9sz\u0151vel, eszk\xF6zzel vagy t\xF6ltsd le az appot",
|
|
7251
7524
|
"dynamicFlows.CameraCapture.CameraNotSupported.title": "Kamera nem t\xE1mogatott",
|
|
7252
7525
|
"dynamicFlows.CameraCapture.NoCameraAccess.action": "Kamer\xE1hoz val\xF3 hozz\xE1f\xE9r\xE9s enged\xE9lyez\xE9se",
|
|
@@ -7796,4 +8069,11 @@ classnames/index.js:
|
|
|
7796
8069
|
Licensed under the MIT License (MIT), see
|
|
7797
8070
|
http://jedwatson.github.io/classnames
|
|
7798
8071
|
*)
|
|
8072
|
+
|
|
8073
|
+
screenfull/dist/screenfull.js:
|
|
8074
|
+
(*!
|
|
8075
|
+
* screenfull
|
|
8076
|
+
* v5.2.0 - 2021-11-03
|
|
8077
|
+
* (c) Sindre Sorhus; MIT License
|
|
8078
|
+
*)
|
|
7799
8079
|
*/
|