Fix Canary Patch. (#1257)
This commit is contained in:
parent
45d2517198
commit
a35bd1a9f8
1 changed files with 12 additions and 33 deletions
|
|
@ -372,45 +372,24 @@ export default definePlugin({
|
||||||
predicate: () => !getQuestifySettings().disableQuestsEverything,
|
predicate: () => !getQuestifySettings().disableQuestsEverything,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Alias the selected platform dropdown state before exposing CTA buttons.
|
// Prefer the auto-complete CTA over the console platform selector.
|
||||||
match: /(?<=var \i;)(?=let \i,\i,{quest:\i,questContent:)/,
|
match: /(\i===\i\.\i\.ENROLLED&&)(?=\(0,\i\.\i\)\((\i)\))/,
|
||||||
replace: "let questifySelectedPlatformDropdownVisible;"
|
replace: "$1!$self.canAutoCompleteQuest($2)&&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Prevent the platform selector if the Quest is auto-completable.
|
// Prefer the auto-complete CTA over the desktop-only external-link row.
|
||||||
match: /(?<=ACCEPTED,\i=)(?=\i&&)/,
|
match: /(\(\i===\i\.\i\.ENROLLED\|\|\i===\i\.\i\.INCOMPLETE\)&&)(?=\(0,\i\.\i\)\((\i)\))/,
|
||||||
replace: "!$self.canAutoCompleteQuest(arguments[0].quest)&&"
|
replace: "$1!$self.canAutoCompleteQuest($2)&&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Prevent the platform selector if the Quest is auto-completable.
|
// Let completed/claimed Quests with CTAs use the generalized CTA row.
|
||||||
match: /(?<=SELECT,\i=)(?=\i&&)/,
|
match: /(\(\i===\i\.\i\.COMPLETED\|\|\i===\i\.\i\.CLAIMED\)&&)(?=\(0,\i\.\i\)\((\i)\))/,
|
||||||
replace: "questifySelectedPlatformDropdownVisible=!$self.canAutoCompleteQuest(arguments[0].quest)&&"
|
replace: "$1!$2.config.ctaConfig&&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Always expose the CTA button when available instead of only for videos and activities,
|
// Always expose the external CTA when the Quest has one configured.
|
||||||
// unless the selected platform dropdown is already taking the secondary slot.
|
match: /(?<=wrap:!1,children:\[)(\i)(?=&&\(0,\i\.jsx\)\(\i,\{quest:(\i))/,
|
||||||
match: /(?<=wrap:!1,children:\[)(\i&&[^?]+)/,
|
replace: "($2.config.ctaConfig||$1)"
|
||||||
replace: "((!!arguments[0].quest.config.ctaConfig&&!questifySelectedPlatformDropdownVisible)||($1))"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Let completed/claimed expired Quests with CTAs use the CTA-aware completed branch.
|
|
||||||
match: /(return\()(?=\i.enabled&&\i===\i\.\i\.EXPIRED_CLAIMABLE&&\i\.\i\.has\(\i\))/,
|
|
||||||
replace: "$1!arguments[0].quest.config.ctaConfig&&"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Let completed/claimed expired Quests with CTAs use the CTA-aware completed branch.
|
|
||||||
match: /(?<=\):\i\?\i=)(\i)(?=\?\(0,\i\.jsx\)\(\i,\{quest:\i,sourceQuestContent:\i,onClick:\i,text:\i\}\):)/,
|
|
||||||
replace: "(arguments[0].quest.config.ctaConfig||$1)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Force the CTA-aware complete branch.
|
|
||||||
match: /(?<=analyticsCtxQuestContentRowIndex:\i}\)}\):\i&&\i)(.{0,200}?fullWidth:!0}\)}\):)(\i.enabled.{0,50}?CLAIMED\)&&\i.\i.has\(\i\))(\?\i=)(\i)/,
|
|
||||||
replace: "&&false$1((arguments[0].quest.config.ctaConfig&&arguments[0].quest.userStatus?.completedAt)||($2))$3(true||$4)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Prefer the CTA + progress button branch when Questify can complete the Quest.
|
|
||||||
match: /(?<="data-migration-pending":.{0,400}?enabledQuestStates.has\(\i\)\?)/,
|
|
||||||
replace: "!$self.canAutoCompleteQuest(arguments[0].quest)&&"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue