diff --git a/external/@worldbrain/memex-common b/external/@worldbrain/memex-common index b30ff300df..f7b829aa48 160000 --- a/external/@worldbrain/memex-common +++ b/external/@worldbrain/memex-common @@ -1 +1 @@ -Subproject commit b30ff300dfc3f68d4e3e915ac0e3c6e9185569dc +Subproject commit f7b829aa48c74a97a24b0764ea070d28d1d4101e diff --git a/src/authentication/upgrade-modal/index.tsx b/src/authentication/upgrade-modal/index.tsx index 4cd6abec88..ab6389f565 100644 --- a/src/authentication/upgrade-modal/index.tsx +++ b/src/authentication/upgrade-modal/index.tsx @@ -525,7 +525,7 @@ const Powerups = [ powerUps: { basic: { title: 'Basic', - subTitle: `${DEFAULT_POWERUP_LIMITS.bookmarksPowerUp} uniquely new pages per month. Every page saved, annotated or added to a Space counts once, forever.`, + subTitle: `${DEFAULT_POWERUP_LIMITS.bookmarksPowerUp} uniquely new pages per day. Every page saved, annotated or added to a Space counts once, forever.`, pricing: 'Free', }, pro: { @@ -549,7 +549,7 @@ const Powerups = [ powerUps: { basic: { title: 'Basic', - subTitle: `${DEFAULT_POWERUP_LIMITS.AIpowerup} page sessions per month with Claude-3-Haiku and GPT-3.5-Turbo`, + subTitle: `${DEFAULT_POWERUP_LIMITS.AIpowerup} page sessions per day with Claude-3-Haiku and GPT-3.5-Turbo`, pricing: 'Free', }, pro: { diff --git a/src/content-scripts/constants.ts b/src/content-scripts/constants.ts index ddc82f4a87..5c5abd6f7f 100644 --- a/src/content-scripts/constants.ts +++ b/src/content-scripts/constants.ts @@ -6,8 +6,8 @@ export const ONBOARDING_NUDGES_STORAGE = '@onboarding-nudges' export const ONBOARDING_NUDGES_DEFAULT = { enabled: true, // should the onboarding nudge be shown at all - bookmarksCount: 5, // how many times a page has been scrolled down - youtubeSummaryCount: 5, // how many times a youtube video has been opened + bookmarksCount: 4, // how many times a page has been scrolled down + youtubeSummaryCount: 4, // how many times a youtube video has been opened youtubeTimestampCount: 0, // how many times a youtube video has been opened pageSummaryCount: 0, // how many times did the user encounter a long article worth summarising } diff --git a/src/content-scripts/content_script/global.ts b/src/content-scripts/content_script/global.ts index 39809f939b..5fffe4de56 100644 --- a/src/content-scripts/content_script/global.ts +++ b/src/content-scripts/content_script/global.ts @@ -1644,11 +1644,12 @@ export async function main( const pageHeight = document.documentElement.scrollHeight const elapsedTime = Date.now() - tabOpenedTime - if (scrollPosition > 0.3 * pageHeight && elapsedTime > 1) { + if (scrollPosition > 0.3 * pageHeight && elapsedTime > 10000) { const shouldShow = await updateNudgesCounter( 'bookmarksCount', browser, ) + removeScrollListener() if (shouldShow) { await inPageUI.showRibbon({ action: 'bookmarksNudge' }) } @@ -1657,10 +1658,23 @@ export async function main( const debouncedCheckScrollPosition = debounce(checkScrollPosition, 2000) - document.addEventListener('scroll', debouncedCheckScrollPosition) + const excludedPages = [ + 'https://x.com/', + 'https://twitter.com/', + 'https://twitter.com/messages', + 'https://www.facebook.com/', + 'https://www.instagram.com/', + 'https://www.pinterest.com/', + 'https://web.whatsapp.com/', + 'https://web.telegram.org/', + ] + + if (!excludedPages.includes(window.location.href) && !pageHasBookark) { + document.addEventListener('scroll', debouncedCheckScrollPosition) + } function removeScrollListener() { - window.removeEventListener('scroll', checkScrollPosition) + document.removeEventListener('scroll', debouncedCheckScrollPosition) } if (analyticsBG && hasActivity) { diff --git a/src/in-page-ui/ribbon/react/components/ribbon.tsx b/src/in-page-ui/ribbon/react/components/ribbon.tsx index 13e9733976..62c97a597d 100644 --- a/src/in-page-ui/ribbon/react/components/ribbon.tsx +++ b/src/in-page-ui/ribbon/react/components/ribbon.tsx @@ -75,7 +75,7 @@ export interface Props extends RibbonSubcomponentProps { showFeed: boolean toggleAskAI: (instaExecute: boolean) => void showBookmarksNudge: boolean - setShowBookmarksNudge: (value: boolean, snooze: boolean) => void + setShowBookmarksNudge: (value: boolean, disable?: boolean) => void toggleRabbitHole: () => void toggleQuickSearch: () => void openPDFinViewer: () => void @@ -959,8 +959,8 @@ export default class Ribbon extends Component { 'Hover over the brain icon or use hotkeys to save with Memex.', this.getHotKey('createBookmark', 'medium'), '450px', - () => this.props.setShowBookmarksNudge(false, false), // hide forever - () => this.props.setShowBookmarksNudge(false, true), // snooze + () => this.props.setShowBookmarksNudge(false, true), // hide forever + () => this.props.setShowBookmarksNudge(false, false), // snooze this.props.getRootElement, this.memexLogoRef.current, 'top-end', diff --git a/src/in-page-ui/ribbon/react/containers/ribbon/index.tsx b/src/in-page-ui/ribbon/react/containers/ribbon/index.tsx index 8cadc6c36c..6458959e67 100644 --- a/src/in-page-ui/ribbon/react/containers/ribbon/index.tsx +++ b/src/in-page-ui/ribbon/react/containers/ribbon/index.tsx @@ -142,7 +142,6 @@ export default class RibbonContainer extends StatefulUIElement< this.props.inPageUI.hideRibbon() this.processEvent('setShowBookmarksNudge', { value: true, - snooze: null, }) } } @@ -199,10 +198,10 @@ export default class RibbonContainer extends StatefulUIElement< ) }} showBookmarksNudge={this.state.showBookmarksNudge} - setShowBookmarksNudge={(value, snooze) => { + setShowBookmarksNudge={(value, disable) => { this.processEvent('setShowBookmarksNudge', { value, - snooze, + disable, }) }} toggleAskAI={(instaExecute: boolean) => { diff --git a/src/in-page-ui/ribbon/react/containers/ribbon/logic.ts b/src/in-page-ui/ribbon/react/containers/ribbon/logic.ts index 47d3f915a9..4e283d26b0 100644 --- a/src/in-page-ui/ribbon/react/containers/ribbon/logic.ts +++ b/src/in-page-ui/ribbon/react/containers/ribbon/logic.ts @@ -90,7 +90,7 @@ export type RibbonContainerEvents = UIEvent< setTutorialId: { tutorialIdToOpen: string } toggleShowTutorial: null toggleFeed: null - setShowBookmarksNudge: { value: boolean; snooze: boolean } + setShowBookmarksNudge: { value: boolean; disable?: boolean } toggleReadingView: null toggleAskAI: boolean | null deletePage: null @@ -977,7 +977,7 @@ export class RibbonContainerLogic extends UILogic< showBookmarksNudge: { $set: event.value }, }) - if (!event.snooze) { + if (event.disable) { await disableNudgeType( 'bookmarksCount', this.dependencies.browserAPIs, diff --git a/src/search-injection/img-action-buttons.tsx b/src/search-injection/img-action-buttons.tsx index 1f5aa12d84..8d8303858f 100644 --- a/src/search-injection/img-action-buttons.tsx +++ b/src/search-injection/img-action-buttons.tsx @@ -177,7 +177,8 @@ export const handleRenderImgActionButtons = async ( const currentUrl = window.location.href if (arrayOfSpecialCases.some((url) => currentUrl.includes(url))) { - element = element.parentNode.parentNode.parentNode + element = element.parentNode.parentNode + .parentNode as HTMLImageElement if (element.getAttribute('jsaction')) { element.setAttribute('jsaction', null) } diff --git a/src/util/nudges-utils.tsx b/src/util/nudges-utils.tsx index 067fa50271..e2d5620707 100644 --- a/src/util/nudges-utils.tsx +++ b/src/util/nudges-utils.tsx @@ -26,20 +26,22 @@ export async function updateNudgesCounter( return false } else { nudgeKeyCount = nudgeKeyCount + 1 - if (nudgeKeyCount > ONBOARDING_NUDGES_MAX_COUNT[nudgeType]) { - nudgeKeyCount = 0 - } - onboardingNudgesValues[nudgeType] = nudgeKeyCount - - await browserAPIs.storage.local.set({ - [ONBOARDING_NUDGES_STORAGE]: onboardingNudgesValues, - }) - if (nudgeKeyCount === ONBOARDING_NUDGES_MAX_COUNT[nudgeType]) { + await browserAPIs.storage.local.set({ + [ONBOARDING_NUDGES_STORAGE]: onboardingNudgesValues, + }) return true + } else { + if (nudgeKeyCount > ONBOARDING_NUDGES_MAX_COUNT[nudgeType]) { + nudgeKeyCount = 0 + } + await browserAPIs.storage.local.set({ + [ONBOARDING_NUDGES_STORAGE]: onboardingNudgesValues, + }) + + return false } - return false } } export async function disableNudgeType( @@ -171,7 +173,7 @@ const NudgeBottomNote = styled.div` color: ${(props) => props.theme.colors.blac}; font-size: 12px; text-align: center; - border-top: 1px solid ${(props) => props.theme.colors.white}; + /* border-top: 1px solid ${(props) => props.theme.colors.white}; */ box-sizing: border-box; width: 100%; margin-top: 15px;