@cuemath/web-utils 0.0.2-beta.4 → 0.0.2-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cookie/index.d.ts +4 -0
- package/dist/cookie/index.js +45 -0
- package/dist/cookie/index.js.map +1 -0
- package/dist/growth-source/index.d.ts +6 -0
- package/dist/growth-source/index.js +151 -0
- package/dist/growth-source/index.js.map +1 -0
- package/dist/growth-source/types.d.ts +25 -0
- package/dist/growth-source/types.js +3 -0
- package/dist/growth-source/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getCookie: (name: string, cookie?: string) => string;
|
|
2
|
+
export declare function removeCookie(name: string): void;
|
|
3
|
+
export declare function createCookie(name: string, value: string, days: number, subdomain: boolean): void;
|
|
4
|
+
export declare function createCookieWithMidnightExp(name: string, value: string): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCookieWithMidnightExp = exports.createCookie = exports.removeCookie = exports.getCookie = void 0;
|
|
4
|
+
const getCookie = (name, cookie = document.cookie) => {
|
|
5
|
+
if (!cookie) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
const cookies = cookie.split('; ');
|
|
9
|
+
for (let i = 0; i < cookies.length; i += 1) {
|
|
10
|
+
if (cookies[i]) {
|
|
11
|
+
const [key, value] = cookies[i].split('=');
|
|
12
|
+
if (key === name) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return '';
|
|
18
|
+
};
|
|
19
|
+
exports.getCookie = getCookie;
|
|
20
|
+
function removeCookie(name) {
|
|
21
|
+
const date = new Date();
|
|
22
|
+
// Set it expire in -1 days
|
|
23
|
+
date.setTime(date.getTime() + -1 * 24 * 60 * 60 * 1000);
|
|
24
|
+
// Set it
|
|
25
|
+
document.cookie = `${name}=; expires=${date.toUTCString()}; path=/`;
|
|
26
|
+
}
|
|
27
|
+
exports.removeCookie = removeCookie;
|
|
28
|
+
function createCookie(name, value, days, subdomain) {
|
|
29
|
+
let expires = '';
|
|
30
|
+
if (days) {
|
|
31
|
+
const date = new Date();
|
|
32
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
33
|
+
expires = `; expires=${date.toUTCString()}`;
|
|
34
|
+
}
|
|
35
|
+
document.cookie = `${name}=${encodeURIComponent(value)}${expires}; path=/${subdomain ? '; .cuemath.com' : ''}`;
|
|
36
|
+
}
|
|
37
|
+
exports.createCookie = createCookie;
|
|
38
|
+
function createCookieWithMidnightExp(name, value) {
|
|
39
|
+
const date = new Date();
|
|
40
|
+
date.setHours(24, 0, 0, 0);
|
|
41
|
+
const expires = `; expires=${date}`;
|
|
42
|
+
document.cookie = `${name}=${value}${expires}; path=/`;
|
|
43
|
+
}
|
|
44
|
+
exports.createCookieWithMidnightExp = createCookieWithMidnightExp;
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cookie/index.ts"],"names":[],"mappings":";;;AAAO,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,SAAiB,QAAQ,CAAC,MAAM,EAAU,EAAE;IAClF,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,CAAC;KACX;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QAC1C,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;YACd,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,C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AC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,aAAa,IAAI,EAAE,CAAC;IAEpC,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,IAAI,KAAK,GAAG,OAAO,UAAU,CAAC;AACzD,CAAC;AAPD,kEAOC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SourceDetails } from './types';
|
|
2
|
+
export declare const readSourceCookie: () => SourceDetails;
|
|
3
|
+
export declare const isSourcePresent: () => boolean;
|
|
4
|
+
export declare const initSourceDetails: ({ platform, experiments, flow, affiliateChannel, offlineChannel, organicChannel, performanceChannel, revenueChannel, }: SourceDetails) => Promise<void>;
|
|
5
|
+
export declare const setLastPage: (pagePath: string) => Promise<void>;
|
|
6
|
+
export declare const setFlowEntryPoint: (flowEntry: string) => Promise<void>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setFlowEntryPoint = exports.setLastPage = exports.initSourceDetails = exports.isSourcePresent = exports.readSourceCookie = void 0;
|
|
4
|
+
const cookie_1 = require("../cookie");
|
|
5
|
+
const SOURCE_DETAILS_COOKIE = 'source_details';
|
|
6
|
+
const UTM_PARAMS = [
|
|
7
|
+
'utm_source',
|
|
8
|
+
'utm_medium',
|
|
9
|
+
'utm_campaign',
|
|
10
|
+
'utm_term',
|
|
11
|
+
];
|
|
12
|
+
const readSourceCookie = () => {
|
|
13
|
+
const sourceDetails = (0, cookie_1.getCookie)(SOURCE_DETAILS_COOKIE);
|
|
14
|
+
return sourceDetails ? JSON.parse(decodeURIComponent(sourceDetails)) : undefined;
|
|
15
|
+
};
|
|
16
|
+
exports.readSourceCookie = readSourceCookie;
|
|
17
|
+
const writeSourceCookie = (sourceDetails) => {
|
|
18
|
+
(0, cookie_1.createCookie)(SOURCE_DETAILS_COOKIE, JSON.stringify(sourceDetails), 365, true);
|
|
19
|
+
};
|
|
20
|
+
const isSourcePresent = () => {
|
|
21
|
+
return !!(0, cookie_1.getCookie)(SOURCE_DETAILS_COOKIE);
|
|
22
|
+
};
|
|
23
|
+
exports.isSourcePresent = isSourcePresent;
|
|
24
|
+
const updateSourceCookie = (sourceDetail) => {
|
|
25
|
+
if (!exports.isSourcePresent)
|
|
26
|
+
return;
|
|
27
|
+
const sourceDetails = (0, exports.readSourceCookie)();
|
|
28
|
+
const updatedDetails = {
|
|
29
|
+
...sourceDetails,
|
|
30
|
+
...sourceDetail,
|
|
31
|
+
};
|
|
32
|
+
writeSourceCookie(updatedDetails);
|
|
33
|
+
};
|
|
34
|
+
const getRevenueChannel = (platform, utmParams) => {
|
|
35
|
+
let revenueChannel = 'unknown';
|
|
36
|
+
// set defaults for WEBSITE and ASTRO
|
|
37
|
+
if (platform === 'website') {
|
|
38
|
+
revenueChannel = 'organic';
|
|
39
|
+
}
|
|
40
|
+
else if (platform === 'astro') {
|
|
41
|
+
revenueChannel = 'performance';
|
|
42
|
+
}
|
|
43
|
+
if (utmParams) {
|
|
44
|
+
const { utm_source: utmSource = '' } = utmParams;
|
|
45
|
+
switch (true) {
|
|
46
|
+
case /^affiliate-/.test(utmSource):
|
|
47
|
+
revenueChannel = 'affiliate';
|
|
48
|
+
break;
|
|
49
|
+
case /^offline-/.test(utmSource):
|
|
50
|
+
revenueChannel = 'offline';
|
|
51
|
+
break;
|
|
52
|
+
case /^referral-/.test(utmSource):
|
|
53
|
+
revenueChannel = 'referral';
|
|
54
|
+
break;
|
|
55
|
+
case /^performance-/.test(utmSource):
|
|
56
|
+
revenueChannel = 'performance';
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return revenueChannel;
|
|
61
|
+
};
|
|
62
|
+
/*
|
|
63
|
+
if Platform = website, then decide based on experiment key
|
|
64
|
+
if Platform = Astro, decide logic once BAU is started
|
|
65
|
+
if Platform = APP, decide logic
|
|
66
|
+
if Platform = chatbot, decide based on chatbot experiment key
|
|
67
|
+
*/
|
|
68
|
+
const getFlow = (platform, experiments) => {
|
|
69
|
+
let flow = 'regular';
|
|
70
|
+
if (platform === 'website') {
|
|
71
|
+
if (experiments) {
|
|
72
|
+
const ecnaExp = Object.keys(experiments).find(experiment => experiment.indexOf('ecna') !== -1);
|
|
73
|
+
flow = ecnaExp && experiments[ecnaExp] === 'b' ? 'e-cna' : 'regular';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return flow;
|
|
77
|
+
};
|
|
78
|
+
const getUTMParams = () => {
|
|
79
|
+
if (typeof window === undefined)
|
|
80
|
+
return;
|
|
81
|
+
const search = new URLSearchParams(window.location.search);
|
|
82
|
+
const utmParams = UTM_PARAMS.reduce((acc, param) => {
|
|
83
|
+
const utmParam = search.get(param);
|
|
84
|
+
if (utmParam) {
|
|
85
|
+
acc[param] = utmParam;
|
|
86
|
+
}
|
|
87
|
+
return acc;
|
|
88
|
+
}, {});
|
|
89
|
+
return utmParams;
|
|
90
|
+
};
|
|
91
|
+
const getFirstPage = () => {
|
|
92
|
+
if (typeof window === undefined)
|
|
93
|
+
return '';
|
|
94
|
+
return window.location.pathname;
|
|
95
|
+
};
|
|
96
|
+
/* TODO: Align Marketing Team on UTM source convention
|
|
97
|
+
affiliate-<channel>
|
|
98
|
+
performance-<channel>
|
|
99
|
+
organic-<channel>
|
|
100
|
+
offline-<channel>
|
|
101
|
+
*/
|
|
102
|
+
const getChannel = (utmParams) => {
|
|
103
|
+
// TODO: UTM source patter for FB, GOOGLE...
|
|
104
|
+
if (!utmParams)
|
|
105
|
+
return '';
|
|
106
|
+
const { utm_source: utmSource = '' } = utmParams;
|
|
107
|
+
return utmSource.split('-')[1];
|
|
108
|
+
};
|
|
109
|
+
/*
|
|
110
|
+
Set Static Source Details of user on Visit of Platform
|
|
111
|
+
*/
|
|
112
|
+
const initSourceDetails = async ({ platform, experiments, flow, affiliateChannel, offlineChannel, organicChannel, performanceChannel, revenueChannel, }) => {
|
|
113
|
+
if (!(0, exports.isSourcePresent)()) {
|
|
114
|
+
const utmParams = getUTMParams();
|
|
115
|
+
const leadChannel = getChannel(utmParams);
|
|
116
|
+
revenueChannel = revenueChannel || getRevenueChannel(platform, utmParams);
|
|
117
|
+
affiliateChannel =
|
|
118
|
+
revenueChannel === 'affiliate' ? affiliateChannel || leadChannel : undefined;
|
|
119
|
+
offlineChannel =
|
|
120
|
+
revenueChannel === 'offline' ? offlineChannel || leadChannel : undefined;
|
|
121
|
+
organicChannel =
|
|
122
|
+
revenueChannel === 'organic' ? organicChannel || leadChannel : undefined;
|
|
123
|
+
performanceChannel =
|
|
124
|
+
revenueChannel === 'performance' ? performanceChannel || leadChannel : undefined;
|
|
125
|
+
const sourceDetails = {
|
|
126
|
+
platform,
|
|
127
|
+
experiments,
|
|
128
|
+
utmParams: getUTMParams(),
|
|
129
|
+
flow: flow || getFlow(platform, experiments),
|
|
130
|
+
affiliateChannel,
|
|
131
|
+
offlineChannel,
|
|
132
|
+
organicChannel,
|
|
133
|
+
performanceChannel,
|
|
134
|
+
revenueChannel: revenueChannel,
|
|
135
|
+
firstPage: getFirstPage(),
|
|
136
|
+
};
|
|
137
|
+
writeSourceCookie(sourceDetails);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
exports.initSourceDetails = initSourceDetails;
|
|
141
|
+
// Last Page which user visited signup before
|
|
142
|
+
const setLastPage = async (pagePath) => {
|
|
143
|
+
updateSourceCookie({ lastPage: pagePath });
|
|
144
|
+
};
|
|
145
|
+
exports.setLastPage = setLastPage;
|
|
146
|
+
// set Entry point where user clicked to Signup
|
|
147
|
+
const setFlowEntryPoint = async (flowEntry) => {
|
|
148
|
+
updateSourceCookie({ flowEntry });
|
|
149
|
+
};
|
|
150
|
+
exports.setFlowEntryPoint = setFlowEntryPoint;
|
|
151
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/growth-source/index.ts"],"names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' | 'leap-admin';
|
|
2
|
+
export type RevenueChannel = 'organic' | 'performance' | 'affiliate' | 'offline' | 'referral' | 'unknown';
|
|
3
|
+
export type SignupFlow = 'regular' | 'e-cna' | 'e-sales';
|
|
4
|
+
export type Experiments = Record<string, unknown>;
|
|
5
|
+
export type UTMParams = {
|
|
6
|
+
utm_source?: string;
|
|
7
|
+
utm_medium?: string;
|
|
8
|
+
utm_campaign?: string;
|
|
9
|
+
utm_term?: string;
|
|
10
|
+
};
|
|
11
|
+
export type UTMParamsKeys = keyof UTMParams;
|
|
12
|
+
export type SourceDetails = {
|
|
13
|
+
platform: Platform;
|
|
14
|
+
experiments?: Experiments;
|
|
15
|
+
flow?: SignupFlow;
|
|
16
|
+
utmParams?: UTMParams;
|
|
17
|
+
affiliateChannel?: string;
|
|
18
|
+
offlineChannel?: string;
|
|
19
|
+
performanceChannel?: string;
|
|
20
|
+
revenueChannel: RevenueChannel;
|
|
21
|
+
organicChannel?: string;
|
|
22
|
+
flowEntry?: string;
|
|
23
|
+
firstPage?: string;
|
|
24
|
+
lastPage?: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/growth-source/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,kDAAgC"}
|