{"version":3,"sources":["webpack://@lemon8/webapp-seo/./src/components/view-tracker/view-observer.ts","webpack://@lemon8/webapp-seo/./src/models/enable-pintrk.ts","webpack://@lemon8/webapp-seo/./src/utils/active/schema.ts","webpack://@lemon8/webapp-seo/./src/utils/active/index.ts","webpack://@lemon8/webapp-seo/./src/utils/active/use-page-active.ts","webpack://@lemon8/webapp-seo/./src/utils/click-position.ts","webpack://@lemon8/webapp-seo/./src/utils/is-mobile-user.ts","webpack://@lemon8/webapp-seo/./src/utils/libra/use-basic-condition.ts","webpack://@lemon8/webapp-seo/./src/utils/libra/seo-reflow-v4.ts","webpack://@lemon8/webapp-seo/./src/utils/libra/inp.ts","webpack://@lemon8/webapp-seo/./src/utils/libra/kep-hashtag-pos-opt.ts","webpack://@lemon8/webapp-seo/./src/utils/libra/kep-post-lazy.ts","webpack://@lemon8/webapp-seo/./src/utils/module-type.ts","webpack://@lemon8/webapp-seo/./src/utils/use-reflow-click.ts","webpack://@lemon8/webapp-seo/./src/utils/use-view-tracking.ts"],"names":["buildThreshold","steps","arguments","length","undefined","Array","from","_x","i","DEFAULT_ERROR_MARGIN","DEFAULT_MARGIN","DEFAULT_OPTIONS","errorMargin","defaultMargin","percentCompensation","minTimeVisible","useExistedInstance","config","root","rootMargin","threshold","Math","min","instance","_ViewObserver","constructor","_this","options","_watchElements","entries","containerHeight","window","innerHeight","document","documentElement","clientHeight","filter","entry","isIntersecting","forEach","node","target","element","elements","get","elementHeight","boundingClientRect","getBoundingClientRect","height","_isElementHeightSimilarToContainer","maxIntersectionRatio","isVisible","intersectionRatio","timeoutSet","timeouts","set","setTimeout","_onVisibilityChange","timeout","clearTimeout","delete","observe","callback","visible","observer","unobserve","_reportVisibilityStates","_ref","Object","assign","isNaN","Map","IntersectionObserver","_addEventListeners","destroy","clear","disconnect","_removeEventListeners","addEventListener","removeEventListener","ViewObserver","Factory","$EnablePintrk","atom","region","ipRegion","$Locale","href","$Traffic","includes","EURO_COUNTRY_SET","debugLabel","isArticleSchemaBuildingProps","input","pageType","isVideoSchemaBuildingProps","isUserSchemaBuildingProps","isCategorySchemaBuildingProps","isHashtagSchemaBuildingProps","isPOISchemaBuildingProps","isSearchSchemaBuildingProps","buildSearchSchema","props","query","baseUrl","data","tab","inputClickType","logExtra","search_page_from","search_from","previous_page_name","concat","encodeURIComponent","JSON","stringify","buildSchema","protocol","host","params","URLSearchParams","group_id","groupId","authorId","user_id","userId","channel_id","String","categoryId","hashtag_id","hashtagId","poi_id","poiId","Error","append","pid","campaign","toString","modifyURLForSEM","onelink","URL","location","searchParams","parameter","value","modifyURLForPinterest","generateOneLink","schemaOption","ampExtra","overridePid","store","seoPageId","$PageLevelTraffic","trafficPid","versions","$ABTest","isiOS","isMacOS","$UserAgent","enablePintrk","schema","_objectSpread","seo_page_id","traffic_type","source_group_id","active","optimizeOnelinkActive","$LibraOptimizeOnelinkActive","requestAnimationFrame","pintrk","event_id","lead_type","open","usePageActive","isBanner","useAtomValue","traffic","pageId","PageLevelTrafficUtil","EPageType","contentByTranslate","useCallback","oneLinkAmpExtra","enter_page_type","enter_page_id","ClickPositionPrefix","ClickPosition","$IsMobileUser","isBot","isMobile","useBasicCondition","isInApp","$SEOReflowV42","parameters","_get","$SEOReflowV42ArticleCarousel","isMobileUser","V42Config","$SEOReflowV42InterceptOpt","$SEOReflowV4","$HitSEOReflowV4","V4Config","$SEOReflowV4AllowExpand","$SEOReflowV4ManualPlay","$SEOReflowV4AllowExpandFoldWithAnchor","$SEOReflowV4NeverExpandFoldWithAnchor","$SEOReflowV4AllowExpandFoldWithoutAnchor","$LibraPreconnectOnelinkHost","Boolean","$SEOKepHashtagPosExp","$HitKepHashtagPosForwardExp","$LibraDiscoverPostLazyLoad","ModuleType","useReflowClick","deps","trafficType","isRealUser","shouldReflow","notReflow","useRef","event","defaultBehavior","modalBehavior","reflowBehavior","finallyBehavior","clickEvent","isCTA","forceReflow","eventParams","current_position","click_result","current","Tea","is_cta","preventDefault","stopPropagation","useViewTracking","onView","ref","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EAAQ,GAAGvB,CAAI,CAAC,EAE3BwB,CACT,C","file":"329-b25505093da2613ae58b.js","sourcesContent":["export interface ObserverOptionsType {\n errorMargin: number;\n defaultMargin: number;\n percentCompensation: number;\n minTimeVisible: number;\n useExistedInstance?: boolean;\n config: {\n root: Element | null;\n rootMargin: string;\n threshold: number[];\n };\n}\n\ninterface IViewObserver {\n destroy: () => void;\n\n observe: (element: Element, callback: (visible: boolean) => void) => void;\n unobserve: (element: Element) => void;\n}\n\n/**\n * Build an array of threshold values ranging from 0 to 1\n * @param {Number} steps - number of steps between 0 and 1.0\n * @returns {Number[]} returns array of floats\n */\nexport const buildThreshold = (steps = 1) => {\n const threshold = Array.from({ length: steps }, (_x, i) => i / steps);\n\n // Returns an array like [0, ...n, 1]\n return [...threshold, 1];\n};\n\nconst DEFAULT_ERROR_MARGIN = 0.25;\nconst DEFAULT_MARGIN = 0.2;\n\nexport const DEFAULT_OPTIONS: ObserverOptionsType = {\n // If an element height is similar to the container height,\n // it's very difficult to catch an impression in 250ms.\n // By default, the intersectionRatio of an element should be\n // 1 to be considered seen and so for tall elements we reduce the\n // max intersectionRatio by this value\n errorMargin: DEFAULT_ERROR_MARGIN, // 25%\n\n // default to 0.2. The max intersectionRatio for a regular element\n // should be 0.8 as being _too_ strict can result in missed events.\n defaultMargin: DEFAULT_MARGIN, // 20%\n\n // The container height range at which to compensate with\n // an error margin\n percentCompensation: 0.2, // 20%\n\n // Element must be visible for >= 250ms\n minTimeVisible: 250,\n\n // Use the instance of the observer already exists, stay singleton\n useExistedInstance: true,\n\n // The ViewObserver config\n config: {\n root: null,\n rootMargin: '0px',\n threshold: buildThreshold(1 / Math.min(DEFAULT_ERROR_MARGIN, DEFAULT_MARGIN) + 5),\n },\n};\n\nlet instance: ViewObserver | null = null;\n\nexport default class ViewObserver implements IViewObserver {\n options: ObserverOptionsType;\n elements: Map<\n Element,\n {\n callback: (visible: boolean) => void;\n visible: boolean;\n entry: Element;\n timeoutSet?: boolean;\n }\n >;\n timeouts: Map>;\n observer: IntersectionObserver;\n\n static Factory = {\n get(options: ObserverOptionsType): ViewObserver {\n return new ViewObserver(options);\n },\n };\n\n constructor(options = {}) {\n this.options = Object.assign({}, DEFAULT_OPTIONS, options);\n\n if (isNaN(this.options.minTimeVisible) || this.options.minTimeVisible < 0) {\n this.options.minTimeVisible = DEFAULT_OPTIONS.minTimeVisible;\n }\n\n this.elements = new Map();\n this.timeouts = new Map();\n\n this.observer = new IntersectionObserver(this._watchElements, this.options.config);\n\n this._addEventListeners();\n }\n\n /**\n * Return the single instance of the IntersectionObserver if one exists already,\n * otherwise create an instance\n * @param {Object} options - ViewObserver instantiation options\n * @return {ViewObserver} return instance of the class\n */\n static get(options: ObserverOptionsType): ViewObserver {\n // If an instance of the observer already exists, return the singleton\n // otherwise instantiate a new one\n if (instance && instance instanceof ViewObserver && options.useExistedInstance) {\n return instance;\n }\n\n instance = new ViewObserver(options);\n return instance;\n }\n\n /**\n * Detroy all Maps and event listeners.\n * @returns {void} returns instance\n */\n public destroy(): void {\n // Clear all elements\n this.elements.clear();\n\n // Clear all lingering timeouts\n this.timeouts.clear();\n\n // Disconnect the observer, if available\n if (this.observer && typeof this.observer.disconnect === 'function') {\n this.observer.disconnect();\n }\n\n // Remove all event listeners\n this._removeEventListeners();\n\n instance = null;\n }\n\n /**\n * callback for Intersection Observer\n *\n * Loop through all the observed elements and check if visible\n *\n * @param {Array} [entries] array of [IntersectionObserverEntry],\n */\n private _watchElements = (entries: IntersectionObserverEntry[] = []): void => {\n // If rootBounds does not exist, it will default to the height and width\n // of the viewport\n const containerHeight = window.innerHeight || document.documentElement.clientHeight;\n\n entries\n .filter((entry) => entry.isIntersecting)\n .forEach((entry) => {\n const node = entry.target;\n const element = this.elements.get(node);\n\n // We wrap the child in a container, so we need to ensure we're looking at\n // the bounds of the child and not the wrapper\n const bounds = entry.boundingClientRect || node.getBoundingClientRect();\n\n const elementHeight = bounds.height;\n\n // If the element height is within x% (this.options.percentCompensation)\n // of the container height, use the errorMargin option (this.options.errorMargin).\n // Otherwise default to 0.25. The max intersectionRatio for a regular element\n // should be 0.75 as being _too_ strict can result in missed events.\n const errorMargin = this._isElementHeightSimilarToContainer(elementHeight, containerHeight)\n ? this.options.errorMargin\n : this.options.defaultMargin;\n\n const maxIntersectionRatio =\n containerHeight / elementHeight > 1 ? 1 - errorMargin : containerHeight / elementHeight - errorMargin;\n\n const isVisible = entry.intersectionRatio >= maxIntersectionRatio;\n // Element is still visible since last check\n if (isVisible && element && element.timeoutSet) {\n return;\n }\n\n // If the element is visible\n if (isVisible && element) {\n // Set the visibility state to true but wait until the timeout finishes\n // to fire the event\n element.timeoutSet = true;\n\n // Start timer\n this.timeouts.set(\n node,\n setTimeout(() => {\n // Fire the event\n this._onVisibilityChange(node, true);\n }, this.options.minTimeVisible),\n );\n } else {\n const timeout = this.timeouts.get(node);\n // Fire event\n this._onVisibilityChange(node, false);\n // Element is no longer visible, delete timeout\n clearTimeout(timeout);\n this.timeouts.delete(node);\n if (element) {\n element.timeoutSet = false;\n }\n }\n });\n };\n\n /**\n * Observe an IntersectionObserver entry\n * @param {Element} element the element to watch\n * @param {Function} callback the element callback event\n */\n observe = (element: Element, callback: (visible: boolean) => void): void => {\n this.elements.set(element, {\n callback,\n visible: false,\n entry: element,\n });\n\n this.observer.observe(element);\n };\n\n /**\n * Unobserve an IntersectionObserver entry\n * @param {Element} element the element to unobserve\n */\n unobserve = (element: Element): void => {\n if (!this.elements.get(element)) {\n return;\n }\n\n this.observer.unobserve(element);\n\n this.elements.delete(element);\n };\n\n /**\n * callback for orientationchange or other event which may cause element visible change\n *\n * Fire onChange event listeners for all visible elements\n */\n private _reportVisibilityStates = (): void => {\n this.elements.forEach(({ visible }, element) => {\n if (visible) {\n this._onVisibilityChange(element, visible);\n }\n });\n };\n\n /**\n * Handle DOM element visibility state change\n * @param {Element} element - the DOM node\n * @param {Boolean} visible - the visibility state of the entry\n */\n private _onVisibilityChange(element: Element, visible: boolean): void {\n const entry = this.elements.get(element);\n\n if (!entry) {\n return;\n }\n\n // Set the new visibility state\n entry.visible = visible;\n\n const { callback } = entry;\n callback(visible);\n }\n\n private _isElementHeightSimilarToContainer(elementHeight: number, containerHeight: number): boolean {\n return (\n elementHeight >= containerHeight - containerHeight * this.options.percentCompensation &&\n elementHeight <= containerHeight + containerHeight * this.options.percentCompensation\n );\n }\n\n private _addEventListeners(): void {\n window.addEventListener('focus', this._reportVisibilityStates);\n window.addEventListener('orientationchange', this._reportVisibilityStates);\n }\n\n private _removeEventListeners(): void {\n window.removeEventListener('focus', this._reportVisibilityStates);\n window.removeEventListener('orientationchange', this._reportVisibilityStates);\n }\n}\n","import { $Locale, $Traffic } from '@lemon8/webapp-shared/model';\nimport { EURO_COUNTRY_SET } from '@lemon8/webapp-shared/i18n';\nimport { atom } from 'jotai';\n\nexport const $EnablePintrk = atom((get) => {\n const { region, ipRegion } = get($Locale);\n const { href } = get($Traffic);\n\n return (\n (href.includes('pid=pinterest_int') || href.includes('pid=US_pinterest')) &&\n region === 'us' &&\n !EURO_COUNTRY_SET.has(ipRegion)\n );\n});\n","interface CommonSchemaBuildingProps {\n pageType: string;\n\n // 拉活渠道细分 TODO type\n campaign?: string;\n}\n\ninterface DetailSchemaBuildingProps extends CommonSchemaBuildingProps {\n groupId: string;\n authorId?: string;\n}\n\ninterface ArticleSchemaBuildingProps extends DetailSchemaBuildingProps {\n pageType: 'article';\n}\n\nconst isArticleSchemaBuildingProps = (input: CommonSchemaBuildingProps): input is ArticleSchemaBuildingProps =>\n input.pageType === 'article';\n\ninterface VideoSchemaBuildingProps extends DetailSchemaBuildingProps {\n pageType: 'video';\n}\n\nconst isVideoSchemaBuildingProps = (input: CommonSchemaBuildingProps): input is VideoSchemaBuildingProps =>\n input.pageType === 'video';\n\nexport interface UserSchemaBuildingProps extends CommonSchemaBuildingProps {\n pageType: 'user';\n userId: string;\n}\n\nconst isUserSchemaBuildingProps = (input: CommonSchemaBuildingProps): input is UserSchemaBuildingProps =>\n input.pageType === 'user';\n\ninterface CategorySchemaBuildingProps extends CommonSchemaBuildingProps {\n pageType: 'feed';\n categoryId: number;\n}\n\nconst isCategorySchemaBuildingProps = (input: CommonSchemaBuildingProps): input is CategorySchemaBuildingProps =>\n input.pageType === 'feed';\n\nexport interface HashtagSchemaBuildingProps extends CommonSchemaBuildingProps {\n pageType: 'hashtag';\n hashtagId: string;\n}\n\nconst isHashtagSchemaBuildingProps = (input: CommonSchemaBuildingProps): input is HashtagSchemaBuildingProps =>\n input.pageType === 'hashtag';\n\nexport interface POISchemaBuildingProps extends CommonSchemaBuildingProps {\n pageType: 'poi';\n poiId: string;\n}\n\nconst isPOISchemaBuildingProps = (input: CommonSchemaBuildingProps): input is POISchemaBuildingProps =>\n input.pageType === 'poi';\n\nexport interface SearchSchemaBuildingProps extends CommonSchemaBuildingProps {\n pageType: 'search';\n query: string;\n}\n\nconst isSearchSchemaBuildingProps = (input: CommonSchemaBuildingProps): input is SearchSchemaBuildingProps =>\n input.pageType === 'search';\n\nconst buildSearchSchema = (props: SearchSchemaBuildingProps): string => {\n const { query } = props;\n\n const baseUrl =\n 'snssdk2657://lynxview?channel=search_v2&trans_status_bar=1&enter_anim=search_alpha&exit_anim=search_alpha&business_type=search&bundle=result_page%2Ftemplate.js';\n\n const data = {\n query,\n tab: 0,\n inputClickType: 'open',\n logExtra: {\n query,\n search_page_from: 'search_page_general',\n search_from: 'seo_click',\n previous_page_name: 'seo',\n },\n };\n\n return `${baseUrl}&business_data=${encodeURIComponent(JSON.stringify(data))}`;\n};\n\nexport type DeepLinkBuildingProps =\n | ArticleSchemaBuildingProps\n | VideoSchemaBuildingProps\n | UserSchemaBuildingProps\n | CategorySchemaBuildingProps\n | HashtagSchemaBuildingProps\n | POISchemaBuildingProps\n | SearchSchemaBuildingProps;\n\nexport const buildSchema = (props: DeepLinkBuildingProps & { pid: string }): string => {\n // 唤活到搜索\n if (isSearchSchemaBuildingProps(props)) {\n return buildSearchSchema(props);\n }\n\n let protocol = 'snssdk2657:';\n let host = 'unknown';\n let params: URLSearchParams;\n\n // TODO is local test;\n\n if (isArticleSchemaBuildingProps(props)) {\n host = 'article_detail_page';\n params = new URLSearchParams({\n group_id: props.groupId,\n });\n if (props.authorId) {\n params.set('media_id', props.authorId);\n }\n } else if (isVideoSchemaBuildingProps(props)) {\n host = 'video_detail';\n params = new URLSearchParams({\n group_id: props.groupId,\n });\n if (props.authorId) {\n params.set('media_id', props.authorId);\n }\n } else if (isUserSchemaBuildingProps(props)) {\n host = 'user_profile';\n params = new URLSearchParams({\n user_id: props.userId,\n });\n } else if (isCategorySchemaBuildingProps(props)) {\n host = 'main';\n params = new URLSearchParams({\n tab: 'home',\n channel_id: String(props.categoryId),\n });\n } else if (isHashtagSchemaBuildingProps(props)) {\n host = 'hashtag';\n params = new URLSearchParams({\n hashtag_id: props.hashtagId,\n });\n } else if (isPOISchemaBuildingProps(props)) {\n host = 'poi_landing_page';\n params = new URLSearchParams({\n poi_id: props.poiId,\n });\n } else {\n throw new Error('unexcepted schema target');\n }\n\n // append common params\n params.append('pid', props.pid);\n if (props.campaign) {\n params.append('campaign', props.campaign);\n }\n\n return `${protocol}//${host}?${params.toString()}`;\n};\n","import { $PageLevelTraffic } from 'shared/atoms';\nimport { buildSchema, DeepLinkBuildingProps } from './schema';\nimport { $ABTest, $UserAgent, $Traffic } from '@lemon8/webapp-shared/model';\nimport { $EnablePintrk } from '~/models/enable-pintrk';\nimport { $LibraOptimizeOnelinkActive } from '~/utils/libra';\n\nexport interface ActiveProps {\n pid?: string;\n schemaOption: DeepLinkBuildingProps;\n ampExtra: Record;\n}\n\nconst modifyURLForSEM = (onelink: URL): void => {\n const href = new URL(location.href);\n\n if (href.searchParams.get('ad_platform_id') !== 'googleadwords_int_lead') {\n return;\n }\n\n onelink.searchParams.set('pid', 'google_sem');\n onelink.searchParams.set('af_prt', 'wezonet');\n\n const afParameters = ['af_c_id', 'af_adset_id', 'af_ad_id', 'af_keywords', 'af_channel', 'placement', 'target'];\n\n afParameters.forEach((parameter) => {\n const value = href.searchParams.get(parameter);\n if (value) {\n onelink.searchParams.set(parameter, value);\n }\n });\n};\n\nconst modifyURLForPinterest = (onelink: URL): void => {\n const href = new URL(location.href);\n\n const afParameters = [\n 'pid',\n 'af_siteid',\n 'c',\n 'af_adset',\n 'af_adset_id',\n 'af_ad',\n 'af_ad_id',\n 'af_c_id',\n 'af_click_lookback',\n 'clickid',\n 'sha1_idfa',\n 'tracking',\n 'appid',\n 'timestamp',\n 'af_prt',\n ];\n\n afParameters.forEach((parameter) => {\n const value = href.searchParams.get(parameter);\n if (value) {\n onelink.searchParams.set(parameter, value);\n }\n });\n};\n\nexport const generateOneLink = (props: ActiveProps): string => {\n const { schemaOption, ampExtra, pid: overridePid } = props;\n const store = window.store;\n const { seoPageId } = store.get($PageLevelTraffic);\n const { pid: trafficPid } = store.get($Traffic);\n const { versions } = store.get($ABTest);\n const { isiOS, isMacOS } = store.get($UserAgent);\n const enablePintrk = store.get($EnablePintrk);\n\n const pid = overridePid || trafficPid;\n\n const schema = buildSchema({\n ...schemaOption,\n pid,\n });\n\n const onelink = new URL('https://lemon8.onelink.me/FMQw');\n onelink.searchParams.set('pid', pid);\n onelink.searchParams.set('af_force_dp', 'false');\n onelink.searchParams.set('af_dp', schema);\n onelink.searchParams.set('retargeting', 'true');\n onelink.searchParams.set('ab_version', versions);\n onelink.searchParams.set(\n 'af_web_dp',\n isiOS || isMacOS\n ? 'https://itunes.apple.com/app/apple-store/id1498607143?pt=1613620&ct=interstitialdownload&mt=8'\n : 'https://play.google.com/store/apps/details?id=com.bd.nproject',\n );\n onelink.searchParams.set(\n 'amp_extra',\n JSON.stringify({\n seo_page_id: seoPageId,\n traffic_type: pid,\n ...ampExtra,\n }),\n );\n\n if (props.ampExtra.source_group_id) {\n onelink.searchParams.set('af_ad', `?${props.ampExtra.source_group_id}`);\n }\n\n modifyURLForSEM(onelink);\n if (enablePintrk) {\n modifyURLForPinterest(onelink);\n }\n\n return onelink.toString();\n};\n\nexport const active = (props: ActiveProps): void => {\n const onelink = generateOneLink(props);\n\n const optimizeOnelinkActive = window.store.get($LibraOptimizeOnelinkActive);\n const enablePintrk = window.store.get($EnablePintrk);\n\n if (optimizeOnelinkActive) {\n requestAnimationFrame(() => {\n setTimeout(() => {\n if (enablePintrk && 'pintrk' in window) {\n window.pintrk('track', 'lead', {\n event_id: 'eventId0001',\n lead_type: 'Newsletter',\n });\n }\n\n window.open(onelink);\n }, 0);\n });\n } else {\n if (enablePintrk && 'pintrk' in window) {\n window.pintrk('track', 'lead', {\n event_id: 'eventId0001',\n lead_type: 'Newsletter',\n });\n }\n\n window.open(onelink);\n }\n};\n","import { useCallback } from 'react';\nimport { active, ActiveProps } from './index';\nimport { $Locale, $Traffic } from '@lemon8/webapp-shared';\nimport { useAtomValue } from 'jotai';\nimport { $PageLevelTraffic } from 'shared/atoms';\nimport { EPageType, PageLevelTrafficUtil } from 'shared/models';\n\ninterface UsePageActiveProps {\n /** 是否是banner,用于区分discover页不同的pid */\n isBanner?: boolean;\n}\n\nexport type UsePageActiveCallbackProps = Omit;\n\nexport const usePageActive = (props: UsePageActiveProps = {}) => {\n const { isBanner = false } = props;\n const { region } = useAtomValue($Locale);\n\n const { pid: trafficPid } = useAtomValue($Traffic);\n const traffic = useAtomValue($PageLevelTraffic);\n const { pageType } = traffic;\n const pageId = PageLevelTrafficUtil.getPageIdFromTraffic(traffic);\n\n let pid = trafficPid;\n if (pageType === EPageType.discover) {\n pid = isBanner ? 'website_seo_discover_banner' : 'website_seo_discover';\n }\n\n if (traffic.pageType === EPageType.article || traffic.pageType === EPageType.video) {\n pid = traffic.contentByTranslate === 1 ? `website_seo_translate_${region}` : pid;\n }\n\n return useCallback(\n (props: UsePageActiveCallbackProps) => {\n const { schemaOption, ampExtra } = props;\n\n const oneLinkAmpExtra: Record = {\n traffic_type: pid,\n // current page info, not enter page\n enter_page_type: pageType,\n // current page info, not enter page\n enter_page_id: pageId,\n // related-to campaign.gid, for new user acceptance\n ...ampExtra,\n };\n\n // append source_group_id\n // 1. activating target page is article or video\n // 2. activating source page is article or video\n if (schemaOption.pageType === 'article' || schemaOption.pageType === 'video') {\n oneLinkAmpExtra.source_group_id = schemaOption.groupId;\n } else if (traffic.pageType === 'article' || traffic.pageType === 'video') {\n oneLinkAmpExtra.source_group_id = traffic.groupId;\n }\n\n active({\n pid,\n schemaOption,\n ampExtra: oneLinkAmpExtra,\n });\n },\n [pid, pageType, pageId],\n );\n};\n","export const enum ClickPositionPrefix {\n category = 'category_',\n none = '',\n}\n\nexport const enum ClickPosition {\n pwa_notification_banner = 'pwa_notification_banner',\n intercept_banner = 'intercept_banner',\n first_landing_dialog = 'first_landing_dialog',\n side_bar_homepage = 'side_bar_homepage',\n side_bar_pp = 'side_bar_pp',\n side_bar_tos = 'side_bar_tos',\n side_bar_cookie = 'side_bar_cookie',\n side_bar_avmsd = 'side_bar_avmsd',\n side_bar_download = 'side_bar_download',\n side_bar_category = 'side_bar_category',\n side_bar_email = 'side_bar_email',\n top_bar_logo = 'top_bar_logo',\n top_bar_side = 'top_bar_side',\n top_bar_share = 'top_bar_share',\n top_bar_search = 'top_bar_search',\n top_bar_download = 'top_bar_download',\n top_search_bar = 'top_search_bar',\n main_category = 'main_category',\n main_author = 'main_author',\n main_author_follow_btn = 'main_author_follow_btn',\n main_hashtag = 'main_hashtag',\n main_poi = 'main_poi',\n main_content_poi = 'main_content_poi',\n main_content_mentioned_user = 'main_content_mentioned_user',\n main_sar = 'main_sar',\n main_inner_link = 'main_inner_link',\n main_content_read_more = 'main_content_read_more',\n main_content_read_more_modal = 'main_content_read_more_modal',\n main_content_unfold_cta_btn = 'main_content_unfold_cta_btn',\n main_comment_send = 'main_comment_send',\n main_comment_icon = 'main_comment_icon',\n main_share_icon = 'main_share_icon',\n main_like_icon = 'main_like_icon',\n main_favorite_icon = 'main_favorite_icon',\n main_see_more_btn = 'main_see_more_btn',\n main_read_more = 'main_read_more',\n comment_author = 'comment_author',\n comment_image = 'comment_image',\n comment_like = 'comment_like',\n comment_reply = 'comment_reply',\n comment = 'comment',\n comment_mentioned_user = 'comment_mentioned_user',\n comment_see_more = 'comment_see_more',\n comment_reply_see_more = 'comment_reply_see_more',\n activity_banner = 'activity_banner',\n related_post = 'related_post',\n related_post_carousel = 'related_post_carousel',\n related_dialog = 'related_dialog',\n related_hashtag = 'related_hashtag',\n related_hashtag_with_article_card = 'related_hashtag_with_article_card',\n related_hashtag_article_card = 'related_hashtag_article_card',\n related_phone = 'related_phone',\n related_address = 'related_address',\n related_user = 'related_user',\n user_fans = 'user_fans',\n user_following = 'user_following',\n user_likes = 'user_likes',\n share_panel_icon = 'share_panel_icon',\n unknown = 'unknown',\n bottom_button = 'bottom_button',\n original_post_banner = 'original_post_banner',\n main_gallery_slide = 'main_gallery_slide',\n main_gallery_slide_modal = 'main_gallery_slide_modal',\n main_video_see_more = 'main_video_see_more',\n main_video_see_more_modal = 'main_video_see_more_modal',\n main_video_pause_auto = 'main_video_pause_auto',\n main_video_replay = 'main_video_replay',\n main_video_replay_modal = 'main_video_replay_modal',\n main_video_pause_manual = 'main_video_pause_manual',\n main_video_pause_manual_modal = 'main_video_pause_manual_modal',\n main_video_download_banner = 'main_video_download_banner',\n main_video_play = 'main_video_play',\n main_video_play_modal = 'main_video_play_modal',\n see_more_button = 'see_more_button',\n view_more_button = 'view_more_button',\n kep_breadcrumbs = 'kep_breadcrumbs',\n main_related_post = 'main_related_post',\n gallery_img = 'gallery_img',\n gallery_img_open = 'gallery_img_open',\n gallery_img_open_modal = 'gallery_img_open_modal',\n gallery_img_mask_open_btn = 'gallery_img_mask_open_btn',\n gallery_img_mask_close_btn = 'gallery_img_mask_close_btn',\n co_creator = 'co_creator',\n kep_classify_hot_keyword = 'kep_classify_hot_keyword',\n // pc reflow qrcode\n scan_code = 'scan_code',\n\n // the following string is concat by ClickPositionPrefix + ClickPosition\n // Please ensure the correctness of the value yourself\n\n category_related_post = 'category_related_post',\n category_view_more = 'category_view_more_button',\n category_see_more = 'category_see_more_button',\n related_search = 'related_search',\n bottom_sar_search = 'bottom_sar_search',\n}\n","import { $UserAgent } from '@lemon8/webapp-shared/model';\nimport { atom } from 'jotai';\n\nexport const $IsMobileUser = atom((get) => {\n const { isBot, isMobile } = get($UserAgent);\n\n return !isBot && isMobile;\n});\n","import { useAtomValue } from 'jotai';\nimport { $UserAgent } from '@lemon8/webapp-shared';\n\n/**\n * @deprecated use $IsMobileUser\n */\nexport function useBasicCondition(): boolean {\n const { isBot, isMobile, isInApp } = useAtomValue($UserAgent);\n\n return !isBot && isMobile && !isInApp;\n}\n","import { $ABTest } from '@lemon8/webapp-shared/model';\nimport { $IsMobileUser } from '~/utils/is-mobile-user';\nimport { Atom, atom } from 'jotai';\nimport _get from 'lodash/get';\n\n/**\n * 0: control group\n * 1: use article carousel\n * 2: opt article interception\n */\nexport const $SEOReflowV42: Atom = atom((get) => {\n const { parameters } = get($ABTest);\n if (__BUILD_TYPE__ === 'local_dev') {\n return 0;\n }\n return _get(parameters, ['seo_web', 'lemon8.seo_cta_v42'], 0);\n});\n\nexport const $SEOReflowV42ArticleCarousel: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V42Config = get($SEOReflowV42);\n return isMobileUser && V42Config === 1;\n});\n\nexport const $SEOReflowV42InterceptOpt: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V42Config = get($SEOReflowV42);\n return isMobileUser && V42Config === 2;\n});\n\n/**\n * 0: control group\n * Article:\n * 1 means allow content unfolded and display anchors while being folded\n * 2 means disallow content unfolded and display anchors while being folded\n * 3 means allow content unfolded and hide anchors while being folded\n * Video:\n * 1 means display with fixed download banner\n * 2 means play video manually\n * 3 means 1 + 2\n */\nexport const $SEOReflowV4: Atom = atom((get) => {\n const { parameters } = get($ABTest);\n if (__BUILD_TYPE__ === 'local_dev') {\n return 2;\n }\n return _get(parameters, ['seo_web', 'lemon8.seo_reflow_v4'], 2);\n});\n\nexport const $HitSEOReflowV4: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V4Config = get($SEOReflowV4);\n return isMobileUser && V4Config !== 0;\n});\n\n/**\n * Article: 1 or 3 means folded content can be expanded after click\n * Video: 1 or 3 means display with fixed download banner\n */\nexport const $SEOReflowV4AllowExpand: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V4Config = get($SEOReflowV4);\n return isMobileUser && (V4Config === 1 || V4Config === 3);\n});\n\n/**\n * Article: 2 or 3 has no common features, thus this combination means nothing\n * Video: 2 or 3 means video should be played manually\n */\nexport const $SEOReflowV4ManualPlay: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V4Config = get($SEOReflowV4);\n return isMobileUser && (V4Config === 2 || V4Config === 3);\n});\n\n// hit 1st test group\nexport const $SEOReflowV4AllowExpandFoldWithAnchor: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V4Config = get($SEOReflowV4);\n return isMobileUser && V4Config === 1;\n});\n\n// hit 2nd test group\nexport const $SEOReflowV4NeverExpandFoldWithAnchor: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V4Config = get($SEOReflowV4);\n return isMobileUser && V4Config === 2;\n});\n\n// hit 3rd test group\nexport const $SEOReflowV4AllowExpandFoldWithoutAnchor: Atom = atom((get) => {\n const isMobileUser = get($IsMobileUser);\n const V4Config = get($SEOReflowV4);\n return isMobileUser && V4Config === 3;\n});\n","import { $ABTest } from '@lemon8/webapp-shared/model';\nimport { atom } from 'jotai';\nimport _get from 'lodash/get';\n\nexport const $LibraPreconnectOnelinkHost = atom((get) => {\n const { parameters } = get($ABTest);\n\n if (__BUILD_TYPE__ === 'local_dev') {\n return true;\n }\n\n return Boolean(_get(parameters, 'seo_web.preconnect_onelink_host', false));\n});\n\nexport const $LibraOptimizeOnelinkActive = atom((get) => {\n const { parameters } = get($ABTest);\n\n if (__BUILD_TYPE__ === 'local_dev') {\n return true;\n }\n\n return Boolean(_get(parameters, 'seo_web.optimize_onelink_active', false));\n});\n","import { $ABTest } from '@lemon8/webapp-shared/model';\nimport { Atom, atom } from 'jotai';\nimport _get from 'lodash/get';\nimport { $PageLevelTraffic } from 'shared/atoms';\nimport { EPageType } from 'shared/models';\n\n/**\n * 0: control group\n * 1: forward the positions of hashtag big card\n */\nexport const $SEOKepHashtagPosExp: Atom = atom((get) => {\n const { parameters } = get($ABTest);\n if (__BUILD_TYPE__ === 'local_dev') {\n return 1;\n }\n return _get(parameters, ['seo_web', 'lemon8.kep_hashtag_pos_opt'], 0);\n});\n\nexport const $HitKepHashtagPosForwardExp: Atom = atom((get) => {\n const { pageType } = get($PageLevelTraffic);\n\n const kepExpConfig = get($SEOKepHashtagPosExp);\n return kepExpConfig === 1 && pageType === EPageType.discover;\n});\n","import { $ABTest } from '@lemon8/webapp-shared/model';\nimport { atom, Atom } from 'jotai';\nimport _get from 'lodash/get';\n\nexport const $LibraDiscoverPostLazyLoad: Atom = atom((get) => {\n const { parameters } = get($ABTest);\n\n if (__BUILD_TYPE__ === 'local_dev') {\n return true;\n }\n return Boolean(_get(parameters, ['seo_web', 'lemon8.discover_post_lazy'], false));\n});\n","export enum ModuleType {\n related_article = 'related_article',\n category_related_post = 'category_related_post',\n related_hashtag = 'related_hashtag',\n related_topic = 'related_topic',\n related_user = 'related_user',\n kep_breadcrumbs = 'kep_breadcrumbs',\n author_related_article = 'author_related_article',\n hashtag_related_article = 'hashtag_related_article',\n activity_banner = 'activity_banner',\n comment = 'comment',\n main_sar = 'main_sar',\n main_content = 'main_content',\n main_related_post = 'main_related_post',\n gallery_img_mask = 'gallery_img_mask',\n user_homepage_info = 'user_homepage_info',\n co_creator = 'co_creator',\n // pc reflow qrcode\n scan_code = 'scan_code',\n related_search = 'related_search',\n bottom_sar_search = 'bottom_sar_search',\n}\n","import { DependencyList, SyntheticEvent, useCallback, useRef } from 'react';\nimport { ClickPosition } from './click-position';\nimport { $Traffic, $UserAgent } from '@lemon8/webapp-shared';\nimport { useAtomValue } from 'jotai';\nimport { $PageLevelTraffic } from 'shared/atoms';\nimport { EPageType, PageLevelTrafficUtil } from 'shared/models';\n\ninterface ReflowClickConfig {\n /**\n * 默认行为\n */\n defaultBehavior?: (event?: SyntheticEvent) => void;\n /**\n * 触发弹窗行为\n */\n modalBehavior?: (event?: SyntheticEvent) => void;\n /**\n * 强制导流时的行为\n */\n reflowBehavior?: (event?: SyntheticEvent) => void;\n /**\n * 最终都会走到的一个方法\n */\n finallyBehavior?: (event?: SyntheticEvent) => void;\n /**\n * 点击事件上报埋点\n */\n clickEvent?: (event?: SyntheticEvent, bundle?: Record) => Record;\n}\n\n/**\n * 封装强制导流功能的点击事件\n */\nexport default function useReflowClick(config: ReflowClickConfig, deps: DependencyList) {\n const { isMobile, isBot, isInApp } = useAtomValue($UserAgent);\n const { pid: trafficType } = useAtomValue($Traffic); // ssr traffic data\n const traffic = useAtomValue($PageLevelTraffic); // csr traffic data\n const { pageType } = traffic;\n const pageId = PageLevelTrafficUtil.getPageIdFromTraffic(traffic);\n\n const isRealUser = !isBot && isMobile && !isInApp;\n\n // TODO 这个逻辑discover有没有必要?\n const shouldReflow = isRealUser || (isMobile && pageType === EPageType.discover);\n\n const notReflow = useRef(false);\n\n return useCallback(\n (event?: SyntheticEvent) => {\n const { defaultBehavior, modalBehavior, reflowBehavior, finallyBehavior, clickEvent } = config;\n\n let isCTA = 1;\n let forceReflow = false;\n if (clickEvent) {\n const eventParams = clickEvent(event);\n\n const { current_position = '', click_result = '' } = eventParams;\n // 避免discover页弹窗not now也reflow\n if (current_position === ClickPosition.first_landing_dialog && click_result === 'cancel') {\n notReflow.current = true;\n isCTA = 0;\n }\n\n if (current_position === ClickPosition.comment_image) {\n forceReflow = true;\n }\n\n window.Tea('wap_click', {\n ...eventParams,\n is_cta: isCTA,\n });\n }\n\n if (isRealUser && modalBehavior) {\n event?.preventDefault();\n event?.stopPropagation();\n modalBehavior(event);\n } else if ((shouldReflow || forceReflow) && !notReflow.current && reflowBehavior) {\n event?.preventDefault();\n event?.stopPropagation();\n reflowBehavior(event);\n } else {\n defaultBehavior?.(event);\n }\n\n finallyBehavior?.(event);\n },\n [config, isMobile, shouldReflow, pageType, trafficType, pageId, notReflow, ...deps],\n );\n}\n","import { RefObject, useRef, useEffect, useState } from 'react';\nimport ViewObserver, { DEFAULT_OPTIONS } from '~/components/view-tracker/view-observer';\n\ninterface UseViewTrackingProps {\n ref?: RefObject;\n onView: () => void;\n}\n\nexport const useViewTracking = (\n props: UseViewTrackingProps,\n deps: unknown[] = [],\n): RefObject => {\n const { onView, ref: inputRef } = props;\n const ref = inputRef || useRef(null);\n const [tracked, setTracked] = useState(false);\n\n useEffect(() => {\n const element = ref.current;\n if (!element || tracked) {\n return;\n }\n\n const observer = ViewObserver.get(DEFAULT_OPTIONS);\n observer.observe(element, (visible: boolean) => {\n if (visible) {\n onView();\n setTracked(true);\n observer.unobserve(element);\n }\n });\n\n return () => {\n observer.unobserve(element);\n };\n }, [ref, tracked, onView, ...deps]);\n\n return ref;\n};\n"],"sourceRoot":""}