Software: Microsoft-IIS/10.0. PHP/7.4.33 uname -a: Windows NT LAKE 10.0 build 20348 (Windows Server 2016) AMD64 IWPD_801(traduongco) Safe-mode: OFF (not secure) C:\Windows\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\webapps\inclusiveOobe\js\ drwxrwxrwx | |
| Viewing file: Select action/file-type: //
// Copyright (C) Microsoft. All rights reserved.
//
define(['lib/knockout', 'legacy/bridge', 'legacy/events', 'legacy/core', 'corejs/knockouthelpers'], (ko, bridge, constants, core, KoHelpers) => {
class HelloViewModel {
constructor(resourceStrings, enrollmentKinds, targetPersonality) {
const cxhSpeech = CloudExperienceHostAPI.Speech;
const winSpeech = Windows.Media.SpeechRecognition;
const isLiteWhitePersonality = (targetPersonality === CloudExperienceHost.TargetPersonality.LiteWhite);
this.resourceStrings = resourceStrings;
this.enrollmentKinds = enrollmentKinds;
this.processingFlag = ko.observable(false);
this.contentContainerVisibility = ko.observable(true);
this.flexStartHyperLinks = [];
this.title = ko.observable("");
this.leadText = ko.observable("");
this.flexEndButtons = ko.observableArray([]);
this.subtitle = ko.observable("");
this.helloAnim = null;
this.isMultiChoice = (this.enrollmentKinds.face && this.enrollmentKinds.fingerprint);
this.showAnimatedGifForFace = !isLiteWhitePersonality;
this.hideContentWhileBioAppIsLaunched = !isLiteWhitePersonality;
this.showConfirmationPage = isLiteWhitePersonality;
this.skipOnIncompleteEnrollment = isLiteWhitePersonality;
if (this.isMultiChoice) {
this.title(resourceStrings.HelloTitleMulti);
this.items = [
{
face: true,
fingerprint: false,
ariaLabel: resourceStrings.HelloFaceIconAriaLabel,
title: resourceStrings.HelloOptionTitleFace,
description: resourceStrings.HelloLeadTextFace
},
{
face: false,
fingerprint: true,
ariaLabel: resourceStrings.HelloFingerprintIconAriaLabel,
title: resourceStrings.HelloOptionTitleFingerprint,
description: resourceStrings.HelloOptionBodyFingerprint
}
];
this.selectedItem = ko.observable(this.items[0]);
this.selectedItem.subscribe((newSelectedItem) => {
if (this.selectedItem().title != newSelectedItem.title) {
if (newSelectedItem.face) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentDisambiguationFaceSelected");
} else if (newSelectedItem.fingerprint) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentDisambiguationFingerprintSelected");
}
}
});
} else {
if (this.enrollmentKinds.face) {
if (this.showAnimatedGifForFace)
{
const faceAnimation = document.getElementById("helloFaceAnimation");
faceAnimation.src = "/media/HelloFaceAnimation.gif";
this.ariaLabel = resourceStrings.HelloFaceAnimationAltText;
}
else
{
this.ariaLabel = resourceStrings.HelloFaceIconAriaLabel;
let contentAnimations = document.querySelector("#helloContentLottieAnim");
this.helloAnim = loadContentAnims(contentAnimations, "smileHelloFaceLottie.json", "../../../images/");
}
this.title(resourceStrings.HelloTitleFace);
this.leadText(resourceStrings.HelloLeadTextFace);
} else if (this.enrollmentKinds.fingerprint) {
this.ariaLabel = resourceStrings.HelloFingerprintIconAriaLabel;
this.title(resourceStrings.HelloTitleFingerprint);
this.leadText(resourceStrings.HelloLeadTextFingerprint);
}
}
this.flexEndButtons([
{
buttonText: resourceStrings.HelloButtonText,
buttonType: "button",
isPrimaryButton: true,
autoFocus: !this.isMultiChoice,
buttonClickHandler: (() => {
const enrollmentKind = {
face: ((this.isMultiChoice && this.selectedItem().face) || (!this.isMultiChoice && this.enrollmentKinds.face)),
fingerprint: ((this.isMultiChoice && this.selectedItem().fingerprint) || (!this.isMultiChoice && this.enrollmentKinds.fingerprint))
};
this.onSetUpClick(enrollmentKind);
}),
disableControl: ko.pureComputed(() => {
return this.processingFlag();
})
}
]);
// LiteWhite personality uses css to style a secondary button (isPrimaryButton property == false) as a hyperlink.
// Add "Skip for now" option to the flexEndButton array if this personality is set.
// Otherwise, add to the flexStartHyperLinks array.
if (isLiteWhitePersonality) {
this.flexEndButtons.unshift({
buttonText: resourceStrings.HelloSkipLink,
buttonClickHandler: (() => {
this.onSkipClick();
})
});
if (!this.isMultiChoice) {
this.subtitle(this.leadText());
this.leadText("");
}
}
else {
this.flexStartHyperLinks = [
{
hyperlinkText: resourceStrings.HelloSkipLink,
handler: () => {
this.onSkipClick();
}
}
];
}
this.pageDefaultAction = () => {
if (this.isMultiChoice) {
this.flexEndButtons()[0].buttonClickHandler();
}
}
// Setup simple voiceover and speech recognition using the resource strings
try {
cxhSpeech.SpeechRecognition.stop();
let constraints = [];
const constraintsTags = {
setUp: "setUp", // Enroll with current selection (applicable to single and multi sensor cases)
multiFace: "multiFace", // Enroll with face in a multi sensor case
multiFingerprint: "multiFingerprint", // Enroll with fingerprint in a multi sensor case
skip: "skip" // Skip Windows Hello enrollment
};
if (this.isMultiChoice) {
let multiFaceConstraint = new winSpeech.SpeechRecognitionListConstraint([this.resourceStrings.HelloMultiFace1SpeechConstraint, this.resourceStrings.HelloMultiFace2SpeechConstraint, this.resourceStrings.HelloMultiFace3SpeechConstraint, this.resourceStrings.HelloMultiFace4SpeechConstraint, this.resourceStrings.HelloMultiFace5SpeechConstraint, this.resourceStrings.HelloMultiFace6SpeechConstraint]);
multiFaceConstraint.tag = constraintsTags.multiFace;
let multiFingerprintConstraint = new winSpeech.SpeechRecognitionListConstraint([this.resourceStrings.HelloMultiFingerprint1SpeechConstraint, this.resourceStrings.HelloMultiFingerprint2SpeechConstraint, this.resourceStrings.HelloMultiFingerprint3SpeechConstraint, this.resourceStrings.HelloMultiFingerprint4SpeechConstraint, this.resourceStrings.HelloMultiFingerprint5SpeechConstraint, this.resourceStrings.HelloMultiFingerprint6SpeechConstraint, this.resourceStrings.HelloMultiFingerprint7SpeechConstraint]);
multiFingerprintConstraint.tag = constraintsTags.multiFingerprint;
constraints.push(multiFaceConstraint, multiFingerprintConstraint);
} else {
// Yes and no variations only apply for single sensor case
constraints.push(cxhSpeech.SpeechRecognitionKnownCommands.yes, cxhSpeech.SpeechRecognitionKnownCommands.no);
}
let setUpConstraint = new winSpeech.SpeechRecognitionListConstraint([this.resourceStrings.HelloSetUpSpeechConstraint]);
setUpConstraint.tag = constraintsTags.setUp;
let skipConstraint = new winSpeech.SpeechRecognitionListConstraint([this.resourceStrings.HelloSkip1SpeechConstraint, this.resourceStrings.HelloSkip2SpeechConstraint]);
skipConstraint.tag = constraintsTags.skip;
constraints.push(cxhSpeech.SpeechRecognitionKnownCommands.next, setUpConstraint, skipConstraint);
if (constraints && (constraints.length > 0)) {
let helloVoiceOver = null;
if (this.isMultiChoice) {
helloVoiceOver = this.resourceStrings.HelloMultiVoiceOver;
} else {
if (this.enrollmentKinds.face) {
helloVoiceOver = this.resourceStrings.HelloFaceVoiceOver;
} else if (this.enrollmentKinds.fingerprint) {
helloVoiceOver = this.resourceStrings.HelloFingerprintVoiceOver;
}
}
cxhSpeech.SpeechRecognition.promptForCommandsAsync(helloVoiceOver, constraints).done((result) => {
if (result && !this.processingFlag()) {
if ((result.constraint.tag == constraintsTags.skip) || (result.constraint.tag == cxhSpeech.SpeechRecognitionKnownCommands.no.tag)) {
this.onSkipClick();
} else {
let enrollmentKind = null;
if ((result.constraint.tag == constraintsTags.setUp) || (result.constraint.tag == cxhSpeech.SpeechRecognitionKnownCommands.yes.tag) || (result.constraint.tag == cxhSpeech.SpeechRecognitionKnownCommands.next.tag)) {
enrollmentKind = {
face: ((this.isMultiChoice && this.selectedItem().face) || (!this.isMultiChoice && this.enrollmentKinds.face)),
fingerprint: ((this.isMultiChoice && this.selectedItem().fingerprint) || (!this.isMultiChoice && this.enrollmentKinds.fingerprint))
};
} else if ((result.constraint.tag == constraintsTags.multiFace) || (result.constraint.tag == constraintsTags.multiFingerprint)) {
enrollmentKind = {
face: (result.constraint.tag == constraintsTags.multiFace),
fingerprint: (result.constraint.tag == constraintsTags.multiFingerprint)
};
}
if (enrollmentKind) {
this.onSetUpClick(enrollmentKind);
}
}
}
});
}
}
catch (err) {
}
}
onSetUpClick(enrollmentKind) {
if (!this.processingFlag()) {
this.processingFlag(true);
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentShowingEnrollmentApp");
try {
const cxhSpeech = CloudExperienceHostAPI.Speech;
cxhSpeech.SpeechRecognition.stop();
let helloVoiceOver = null;
if (enrollmentKind.face) {
helloVoiceOver = this.resourceStrings.HelloFaceEnrollmentVoiceOver;
} else if (enrollmentKind.fingerprint) {
helloVoiceOver = this.resourceStrings.HelloFingerprintEnrollmentVoiceOver;
}
cxhSpeech.SpeechRecognition.promptForCommandsAsync(helloVoiceOver, null);
}
catch (err) {
}
bridge.invoke("CloudExperienceHost.getBoundingClientRect").done((result) => {
const rect = {
height: result.height,
width: result.width,
x: result.x * window.devicePixelRatio,
y: result.y * window.devicePixelRatio
};
if (this.hideContentWhileBioAppIsLaunched) {
// Hide the content of this page to avoid undesired flashing after bio enrollment app
// finishes and this page shows up a split second before navigating to next page
this.contentContainerVisibility(false);
}
else {
// Hide all interactable button items from view, but maintain webapp view while bio enrollment app is showing
document.getElementById("helloFlexEndButtons").style.visibility = "hidden";
}
bridge.invoke("CloudExperienceHost.Hello.startHelloEnrollment", enrollmentKind, rect).done((enrollResult) => {
this.contentContainerVisibility(false);
window.removeEventListener("resize", HelloViewModel._onResize);
let enrollmentResult = JSON.parse(enrollResult);
if (enrollmentResult.completedWithError) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentFailed");
bridge.fireEvent(constants.Events.done, constants.AppResult.cancel);
}
else if (enrollmentResult.completed) {
if (this.showConfirmationPage) {
this.updateToConfirmationPage();
}
else {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentSuccess");
bridge.fireEvent(constants.Events.done, constants.AppResult.success);
}
}
else if (this.skipOnIncompleteEnrollment) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentCanceled");
bridge.fireEvent(constants.Events.done, constants.AppResult.cancel);
}
else {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentCanceled");
bridge.invoke("CloudExperienceHost.undimChrome");
if (!this.hideContentWhileBioAppIsLaunched)
{
document.getElementById("helloFlexEndButtons").style.visibility = "visible";
}
this.processingFlag(false);
// Show the content of this page if enrollment app cancels
this.contentContainerVisibility(true);
// Restore focus to the default focusable element as the flow is returning to this page
KoHelpers.setFocusOnAutofocusElement();
}
}, (error) => {
window.removeEventListener("resize", HelloViewModel._onResize);
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentFailed", core.GetJsonFromError(error));
bridge.fireEvent(constants.Events.done, constants.AppResult.fail);
});
window.addEventListener("resize", HelloViewModel._onResize);
bridge.invoke("CloudExperienceHost.dimChrome");
}, (error) => {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentSizingFailed", core.GetJsonFromError(error));
bridge.fireEvent(constants.Events.done, constants.AppResult.fail);
});
}
}
onSkipClick() {
if (!this.processingFlag()) {
this.processingFlag(true);
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentCanceled");
bridge.fireEvent(constants.Events.done, constants.AppResult.cancel);
}
}
updateToConfirmationPage() {
this.title(resourceStrings.AllSetText);
this.subtitle("");
this.flexEndButtons([{
buttonText: resourceStrings.NextButtonText,
buttonType: "button",
isPrimaryButton: true,
autoFocus: true,
buttonClickHandler: (() => {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentSuccess");
bridge.fireEvent(constants.Events.done, constants.AppResult.success);
})
}]);
document.getElementById("helloFlexEndButtons").style.visibility = "visible";
this.processingFlag(false);
this.contentContainerVisibility(true);
if (this.helloAnim)
{
playAnim(this.helloAnim, false);
}
}
static _onResize(param) {
bridge.invoke("CloudExperienceHost.getBoundingClientRect").done((result) => {
try {
const rect = {
height: result.height,
width: result.width,
x: result.x * window.devicePixelRatio,
y: result.y * window.devicePixelRatio
};
bridge.invoke("CloudExperienceHost.Hello.updateWindowLocation", rect);
}
catch (error) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "HelloEnrollmentResizingFailed", core.GetJsonFromError(error));
}
});
}
}
function loadContentAnims(contentAnimations, file, path) {
let name = file.replace(/$.json/, "");
let params = {
assetsPath: path,
container: contentAnimations,
renderer: "svg",
name: name,
loop: false,
autoplay: false,
path: path + file
};
let anim = bodymovin.loadAnimation(params);
anim.addEventListener('DOMLoaded', function () {
anim.goToAndStop(1, true);
});
return anim;
}
function playAnim(anim, loop) {
if (anim.isPaused) {
anim.loop = loop;
anim.play();
}
}
return HelloViewModel;
});
|
:: Command execute :: | |
--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.8545 ]-- |