PageSourceSearch

https://stageyouridea.com/assets/templates/js/curate-tracking-helpers.js?v=315532801

js stageyouridea.com collected 2026-10-06 02:57:50 UTC 4,034 bytes, 123 lines download raw bytes

1(function () {
2    'use strict';
3
4    function briefIdFromUrl() {
5        return new URLSearchParams(window.location.search).get('brief_id');
6    }
7
8    function curateBriefId() {
9        var cfg = window.__SYI_CURATE_BRIEF__ || {};
10        if (cfg.briefId != null && cfg.briefId !== '') {
11            return parseInt(String(cfg.briefId), 10);
12        }
13        var proposalCfg = window.__SYI_CURATE_PROPOSAL__ || {};
14        if (proposalCfg.briefId != null && proposalCfg.briefId !== '') {
15            return parseInt(String(proposalCfg.briefId), 10);
16        }
17        if (typeof window.__SYI_getCurateBriefDraft === 'function') {
18            var draft = window.__SYI_getCurateBriefDraft();
19            if (draft && draft.curate_brief_id != null && draft.curate_brief_id !== '') {
20                return parseInt(String(draft.curate_brief_id), 10);
21            }
22        }
23        var fromUrl = briefIdFromUrl();
24        return fromUrl ? parseInt(fromUrl, 10) : null;
25    }
26
27    function curateBriefSpaceId() {
28        var cfg = window.__SYI_CURATE_PROPOSAL__ || {};
29        if (cfg.curateBriefSpaceId != null && cfg.curateBriefSpaceId !== '') {
30            return parseInt(String(cfg.curateBriefSpaceId), 10);
31        }
32        var el = document.querySelector('[data-curate-brief-space-id]');
33        if (el) {
34            var id = (el.getAttribute('data-curate-brief-space-id') || '').trim();
35            if (id) {
36                return parseInt(id, 10);
37            }
38        }
39        return null;
40    }
41
42    function spaceId() {
43        var container = document.querySelector('.space-page-container');
44        if (container) {
45            return container.getAttribute('data-space-id') || null;
46        }
47        return null;
48    }
49
50    function spaceTitle() {
51        var container = document.querySelector('.space-page-container');
52        if (container) {
53            return container.getAttribute('data-space-title') || null;
54        }
55        return null;
56    }
57
58    function builderStep() {
59        var progress = document.querySelector('.brief-builder-progress[aria-valuenow]');
60        if (progress) {
61            var step = parseInt(progress.getAttribute('aria-valuenow'), 10);
62            if (!isNaN(step) && step >= 1) {
63                return step;
64            }
65        }
66        if (document.querySelector('.brief-builder-page--review')) {
67            return 8;
68        }
69        if (document.querySelector('.brief-builder-page--vision')) {
70            return 7;
71        }
72        if (document.querySelector('.page-curate-brief-results')) {
73            return 9;
74        }
75        if (document.querySelector('.page-host-proposals, .host-proposals-page')) {
76            return 'host_proposals';
77        }
78        if (document.querySelector('.brief-feed-page:not(.host-proposals-page)')) {
79            return 'host_brief_feed';
80        }
81        if (document.querySelector('.proposal-response-page, .pr-body')) {
82            return 'proposal_response';
83        }
84        if (document.querySelector('.space-curate-sidebar, .space-curate-nav, [data-curate-tabs]')) {
85            return 'curate_space';
86        }
87        return null;
88    }
89
90    function context(extra) {
91        var base = {
92            flow: 'curate',
93        };
94        var briefId = curateBriefId();
95        if (briefId) {
96            base.curate_brief_id = briefId;
97        }
98        var briefSpaceId = curateBriefSpaceId();
99        if (briefSpaceId) {
100            base.curate_brief_space_id = briefSpaceId;
101        }
102        var sid = spaceId();
103        if (sid) {
104            base.space_id = sid;
105        }
106        var title = spaceTitle();
107        if (title) {
108            base.space_title = title;
109        }
110        var step = builderStep();
111        if (step) {
112            base.step = step;
113        }
114        return Object.assign(base, extra || {});
115    }
116
117    function track(event, props) {
118        mixpanel?.track(event, context(props));
119    }
120
121    window.__SYI_curateTrack = track;
122    window.__SYI_curateTrackingContext = context;
123})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.