Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCV first pass #10355

Merged
merged 34 commits into from
Feb 6, 2025
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d31eca8
plumbing for showing the feedback iframe
srietkerk Dec 12, 2024
f55fca2
add https flag to the cli to use https when debugging ocv iframe
srietkerk Dec 19, 2024
c705f96
Merge branch 'master' of https://github.com/microsoft/pxt into srietk…
srietkerk Dec 20, 2024
87236db
more config, removed functions, changed height and width of iframe
srietkerk Dec 20, 2024
0593552
using different modal for the feedback
srietkerk Jan 14, 2025
5259143
added feedback menu item to editor menu
srietkerk Jan 14, 2025
9354dc2
got rid of iframe border
srietkerk Jan 14, 2025
a764d25
some small changes and styling
srietkerk Jan 25, 2025
6446b2a
added comments
srietkerk Jan 27, 2025
2120588
move app id to configs
srietkerk Jan 27, 2025
4da2fdc
fix onclose reference
srietkerk Jan 27, 2025
05d4be7
moved frame url to configs
srietkerk Jan 27, 2025
816c662
remove tutorial completion feedback for now
srietkerk Jan 27, 2025
8336f42
use emoji instead of sui icon
srietkerk Jan 27, 2025
bab52a2
merged master
srietkerk Jan 27, 2025
f905236
update iframeelement variable in event listener
srietkerk Jan 28, 2025
4a4eb79
add space to less file
srietkerk Jan 28, 2025
6c86476
another iframe element var change
srietkerk Jan 28, 2025
cd43ef9
moved height, width to less file, fixed some styling
srietkerk Jan 28, 2025
be206b5
remove redundant jsdoc types
srietkerk Jan 28, 2025
2bb7a05
use pxt log functions, fix spacing in the event listener
srietkerk Jan 28, 2025
b209592
move emoji out of lf
srietkerk Jan 28, 2025
9438c18
use lf for the displayed strings for the rating
srietkerk Jan 28, 2025
158939c
types added
srietkerk Jan 30, 2025
c714b42
move types to localtypings and wrap them in a namespace
srietkerk Jan 30, 2025
728ebd8
change to using the comment bubble icon
srietkerk Jan 30, 2025
69ec94d
added types
srietkerk Jan 31, 2025
9dc5367
actually using feedback kind
srietkerk Feb 4, 2025
3e8c6ba
rename feedback app theme field
srietkerk Feb 4, 2025
83b45f8
move iframe init and posting code to helper function
srietkerk Feb 4, 2025
980020a
use optional chaining for ondismiss call
srietkerk Feb 4, 2025
3b6a3ff
move current theme into send update theme function, update theme options
srietkerk Feb 4, 2025
943c493
move questions for rating config to a function
srietkerk Feb 4, 2025
36c823c
move appid, frame url to apptheme
srietkerk Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
move appid, frame url to apptheme
  • Loading branch information
srietkerk committed Feb 5, 2025
commit 36c823c921771dab43e600465f31136481011153
2 changes: 2 additions & 0 deletions localtypings/pxtarget.d.ts
Original file line number Diff line number Diff line change
@@ -525,6 +525,8 @@ declare namespace pxt {
timeMachineSnapshotInterval?: number; // An interval in milliseconds at which to take full project snapshots in project history. Defaults to 15 minutes
adjustBlockContrast?: boolean; // If set to true, all block colors will automatically be adjusted to have a contrast ratio of 4.5 with text
feedbackEnabled?: boolean; // allow feedback to be shown on a target
ocvAppId?: number; // the app id needed to attach to the OCV service
ocvFrameUrl?: string; // the base url for the OCV service
}

interface DownloadDialogTheme {
4 changes: 2 additions & 2 deletions react-common/components/controls/Feedback/Feedback.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference path="../../../../localtypings/ocv.d.ts" />
import { useEffect } from "react"
import { initFeedbackEventListener, removeFeedbackEventListener } from "./FeedbackEventListener";
import { baseConfig, ratingFeedbackConfig, appId, feedbackFrameUrl } from "./configs";
import { baseConfig, ratingFeedbackConfig } from "./configs";
import { Modal } from "../Modal";

// both components require onClose because the feedback modal should close when the user clicks the "finish" button
@@ -63,7 +63,7 @@ export const FeedbackModal = (props: IFeedbackModalProps) => {
<iframe
title="feedback"
id={frameId}
src={`${feedbackFrameUrl}/centrohost?appname=ocvfeedback&feature=host-ocv-inapp-feedback&platform=web&appId=${appId}#/hostedpage`}
src={`${pxt.appTarget.appTheme.ocvFrameUrl}/centrohost?appname=ocvfeedback&feature=host-ocv-inapp-feedback&platform=web&appId=${pxt.appTarget.appTheme.ocvAppId}#/hostedpage`}
sandbox="allow-scripts allow-same-origin allow-forms allow-popups" />
</Modal>
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference path="../../../../localtypings/ocv.d.ts" />
import { appId, feedbackFrameUrl } from './configs';

type FeedbackRequestEventArgsType = FeedbackInitOptionsEventPayload | FeedbackErrorEventPayload | FeedbackInitializationCompleteEventPayload | FeedbackOnSuccessEventPayload | FeedbackDismissWithResultEventPayload;

@@ -73,7 +72,7 @@ export const initFeedbackEventListener = (feedbackConfig: ocv.IFeedbackConfig, f
window.addEventListener('message', feedbackCallbackEventListener);
feedbackCallbacks = callbacks;
initfeedbackOptions = {
appId: appId,
appId: pxt.appTarget.appTheme.ocvAppId,
ageGroup: ocv.FeedbackAgeGroup.Undefined,
authenticationType: ocv.FeedbackAuthenticationType.Unauthenticated,
clientName: "MakeCode",
@@ -121,10 +120,10 @@ const feedbackCallbackEventListener = (event: MessageEvent<FeedbackRequestPayloa

// ***************** Helper Functions *****************

const getIFrameAndSend = (payload: FeedbackResponsePayloadType, url: string) => {
const getIFrameAndSend = (payload: FeedbackResponsePayloadType) => {
const iFrameElement = document.getElementById(FEEDBACK_FRAME_ID) as HTMLIFrameElement
if (iFrameElement) {
iFrameElement.contentWindow!.postMessage(payload, feedbackFrameUrl);
iFrameElement.contentWindow!.postMessage(payload, pxt.appTarget.appTheme.ocvFrameUrl);
}
}
// TODO
@@ -144,7 +143,7 @@ const sendUpdateTheme = () => {
},
}
themeOptions.baseTheme = currentTheme;
getIFrameAndSend(response, feedbackFrameUrl);
getIFrameAndSend(response);
}


@@ -156,5 +155,5 @@ const sendFeedbackInitOptions = () => {
event: 'InAppFeedbackInitOptions',
data: initfeedbackOptions,
}
getIFrameAndSend(response, feedbackFrameUrl);
getIFrameAndSend(response);
}
2 changes: 0 additions & 2 deletions react-common/components/controls/Feedback/configs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/// <reference path="../../../../localtypings/ocv.d.ts" />

export const appId = 50315;
export const feedbackFrameUrl = 'https://admin-ignite.microsoft.com';

export const baseConfig: ocv.IFeedbackConfig = {
feedbackUiType: ocv.FeedbackUiType.NoSurface,
2 changes: 1 addition & 1 deletion webapp/src/app.tsx
Original file line number Diff line number Diff line change
@@ -5282,7 +5282,7 @@ export class ProjectView
const hideMenuBar = targetTheme.hideMenuBar || hideTutorialIteration || (isTabTutorial && pxt.appTarget.appTheme.embeddedTutorial) || pxt.shell.isTimeMachineEmbed();
const isHeadless = simOpts && simOpts.headless;
const selectLanguage = targetTheme.selectLanguage;
const feedbackEnabled = targetTheme.feedbackEnabled;
const feedbackEnabled = targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
const showEditorToolbar = inEditor && !hideEditorToolbar && this.editor.hasEditorToolbar();
const useSerialEditor = pxt.appTarget.serial && !!pxt.appTarget.serial.useEditor;
const showSideDoc = sideDocs && this.state.sideDocsLoadUrl && !this.state.sideDocsCollapsed;
3 changes: 2 additions & 1 deletion webapp/src/container.tsx
Original file line number Diff line number Diff line change
@@ -319,6 +319,7 @@ export class SettingsMenu extends data.Component<SettingsMenuProps, SettingsMenu
const showPairDevice = pxt.usb.isEnabled;

const showCenterDivider = targetTheme.selectLanguage || targetTheme.highContrast || showGreenScreen || githubUser;
const showFeedbackOption = targetTheme.feedbackEnabled && targetTheme.ocvAppId && targetTheme.ocvFrameUrl;

const simCollapseText = headless ? lf("Toggle the File Explorer") : lf("Toggle the simulator");

@@ -355,7 +356,7 @@ export class SettingsMenu extends data.Component<SettingsMenuProps, SettingsMenu
{
// we always need a way to clear local storage, regardless if signed in or not
}
{targetTheme.feedbackEnabled ? <sui.Item role="menuitem" icon="comment" text={lf("Give Feedback")} onClick={this.showFeedbackDialog} /> : undefined}
{showFeedbackOption ? <sui.Item role="menuitem" icon="comment" text={lf("Give Feedback")} onClick={this.showFeedbackDialog} /> : undefined}
</sui.DropdownMenu>;
}
}
3 changes: 2 additions & 1 deletion webapp/src/projects.tsx
Original file line number Diff line number Diff line change
@@ -301,6 +301,7 @@ export class ProjectSettingsMenu extends data.Component<ProjectSettingsMenuProps
const githubUser = !hasIdentity && this.getData("github:user") as UserInfo;
const reportAbuse = pxt.appTarget.cloud && pxt.appTarget.cloud.sharing && pxt.appTarget.cloud.importing;
const showDivider = targetTheme.selectLanguage || targetTheme.highContrast || githubUser;
const showFeedbackOption = targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;

return <sui.DropdownMenu role="menuitem" icon={'setting large'} title={lf("Settings")} className="item icon more-dropdown-menuitem" ref={ref => this.dropdown = ref}>
{targetTheme.selectLanguage && <sui.Item icon='xicon globe' role="menuitem" text={lf("Language")} onClick={this.showLanguagePicker} />}
@@ -316,7 +317,7 @@ export class ProjectSettingsMenu extends data.Component<ProjectSettingsMenuProps
{reportAbuse ? <sui.Item role="menuitem" icon="warning circle" text={lf("Report Abuse...")} onClick={this.showReportAbuse} /> : undefined}
<sui.Item role="menuitem" icon='sign out' text={lf("Reset")} onClick={this.showResetDialog} />
<sui.Item role="menuitem" text={lf("About...")} onClick={this.showAboutDialog} />
{targetTheme.feedbackEnabled ? <sui.Item role="menuitem" icon="comment" text={lf("Give Feedback")} onClick={this.showFeedbackDialog} /> : undefined}
{showFeedbackOption ? <sui.Item role="menuitem" icon="comment" text={lf("Give Feedback")} onClick={this.showFeedbackDialog} /> : undefined}
</sui.DropdownMenu>;
}
}