Skip to content

Commit ffa2188

Browse files
committed
Windows Actions is updated to send in actual JSON objects rather than stringified JSON
1 parent 31280d2 commit ffa2188

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

apps/pwabuilder/Frontend/src/script/components/windows-form.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ export class WindowsForm extends AppPackageFormBase {
590590

591591
async updateCustomEntitySelection(checked: boolean) {
592592
// Check if actions file has been uploaded before allowing custom entity selection
593-
if (checked && (!this.packageOptions.windowsActions?.manifest || this.packageOptions.windowsActions.manifest.trim() === "")) {
593+
if (checked && !this.packageOptions.windowsActions?.manifest) {
594594
this.supportCustomEntity = false;
595595
this.customEntitiesFileError = "Please upload an ActionsManifest.json file first before enabling Custom Entity support.";
596596

@@ -667,11 +667,10 @@ export class WindowsForm extends AppPackageFormBase {
667667
}
668668

669669
// Store the valid custom entities content
670-
const stringified: string = JSON.stringify(parsed, null, 2);
671670
if (!this.packageOptions.windowsActions) {
672-
this.packageOptions.windowsActions = { manifest: "" };
671+
this.packageOptions.windowsActions = { manifest: {} };
673672
}
674-
this.packageOptions.windowsActions.customEntities = stringified;
673+
this.packageOptions.windowsActions.customEntities = parsed;
675674
this.customEntitiesFileError = null;
676675

677676
// Show success state
@@ -753,11 +752,11 @@ export class WindowsForm extends AppPackageFormBase {
753752

754753
// Store the valid files in packageOptions
755754
if (!this.packageOptions.windowsActions) {
756-
this.packageOptions.windowsActions = { manifest: "" };
755+
this.packageOptions.windowsActions = { manifest: {} };
757756
}
758757
this.packageOptions.windowsActions.customEntitiesLocalizations = validationResults.validFiles.map(file => ({
759758
fileName: file.name,
760-
contents: file.content
759+
contents: JSON.parse(file.content)
761760
}));
762761
} else {
763762
// Some files failed validation
@@ -856,8 +855,7 @@ export class WindowsForm extends AppPackageFormBase {
856855
throw new Error(`Schema validation failed:\n${errorDetails}`);
857856
}
858857

859-
const stringified: string = JSON.stringify(parsed, null, 2);
860-
this.packageOptions.windowsActions = { manifest: stringified };
858+
this.packageOptions.windowsActions = { manifest: parsed };
861859
this.actionsFileError = null;
862860

863861
// Clear any error state and show success state
@@ -1477,7 +1475,7 @@ export class WindowsForm extends AppPackageFormBase {
14771475
inputId: 'custom-entity-checkbox',
14781476
type: 'checkbox',
14791477
checked: this.supportCustomEntity,
1480-
disabled: !this.packageOptions.windowsActions?.manifest || this.packageOptions.windowsActions.manifest.trim() === "",
1478+
disabled: !this.packageOptions.windowsActions?.manifest,
14811479
disabledTooltipText: "You must upload an ActionsManifest.json file first before enabling Custom Entity support.",
14821480
inputHandler: (_val: string, checked: boolean) =>
14831481
(this.updateCustomEntitySelection(checked)),

apps/pwabuilder/Frontend/src/script/utils/win-validation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ type WindowsActionsOptions = {
6060
/**
6161
* The contents of the ActionsManifest.json file that describes the app's actions.
6262
*/
63-
manifest: string;
63+
manifest: object;
6464

6565
/**
6666
* The contents of the optional customEntities.json file.
6767
*/
68-
customEntities?: string | null;
68+
customEntities?: object | null;
6969

7070
/**
7171
* An array containing localizations for the custom entities file.
@@ -84,7 +84,7 @@ type WindowsActionsCustomEntityLocalization = {
8484
* The contents of the file.
8585
* @example { "english phrase one": { "welcome": "howdy, friends" } }
8686
*/
87-
contents: string;
87+
contents: object;
8888
}
8989

9090
type WindowsPackageValidationError = {

0 commit comments

Comments
 (0)