@cuemath/web-utils 1.2.37 → 2.0.0-beta.0

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.
Files changed (308) hide show
  1. package/README.md +334 -1
  2. package/dist/browser.d.mts +15 -0
  3. package/dist/browser.d.ts +15 -0
  4. package/dist/browser.js +2 -0
  5. package/dist/browser.js.map +1 -0
  6. package/dist/browser.mjs +2 -0
  7. package/dist/browser.mjs.map +1 -0
  8. package/dist/chunk-5X4UT2UI.js +3 -0
  9. package/dist/chunk-5X4UT2UI.js.map +1 -0
  10. package/dist/chunk-CVZIO6BX.mjs +4 -0
  11. package/dist/chunk-CVZIO6BX.mjs.map +1 -0
  12. package/dist/chunk-LUUB665J.mjs +3 -0
  13. package/dist/chunk-LUUB665J.mjs.map +1 -0
  14. package/dist/chunk-OBXSX4MO.js +3 -0
  15. package/dist/chunk-OBXSX4MO.js.map +1 -0
  16. package/dist/chunk-SMWXEBQ2.js +4 -0
  17. package/dist/chunk-SMWXEBQ2.js.map +1 -0
  18. package/dist/chunk-TG7DRTM7.mjs +3 -0
  19. package/dist/chunk-TG7DRTM7.mjs.map +1 -0
  20. package/dist/cloudfront-DRTOCXPV.d.mts +758 -0
  21. package/dist/cloudfront-DRTOCXPV.d.ts +758 -0
  22. package/dist/cloudfront.d.mts +2 -0
  23. package/dist/cloudfront.d.ts +2 -0
  24. package/dist/cloudfront.js +2 -0
  25. package/dist/cloudfront.js.map +1 -0
  26. package/dist/cloudfront.mjs +2 -0
  27. package/dist/cloudfront.mjs.map +1 -0
  28. package/dist/data-props-RvZdA60G.d.mts +157 -0
  29. package/dist/data-props-RvZdA60G.d.ts +157 -0
  30. package/dist/date-time-helper/timezone.d.mts +61 -0
  31. package/dist/date-time-helper/timezone.d.ts +61 -0
  32. package/dist/date-time-helper/timezone.js +2 -0
  33. package/dist/date-time-helper/timezone.js.map +1 -0
  34. package/dist/date-time-helper/timezone.mjs +2 -0
  35. package/dist/date-time-helper/timezone.mjs.map +1 -0
  36. package/dist/{cjs/constants/teacher/index.d.ts → index.d.mts} +63 -1
  37. package/dist/{esm/constants/teacher/index.d.ts → index.d.ts} +63 -1
  38. package/dist/index.js +4 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/index.mjs +4 -0
  41. package/dist/index.mjs.map +1 -0
  42. package/dist/metafile-cjs.json +1 -0
  43. package/dist/metafile-esm.json +1 -0
  44. package/package.json +41 -10
  45. package/dist/cjs/ab-experiment/constants/index.d.ts +0 -64
  46. package/dist/cjs/ab-experiment/constants/index.js +0 -68
  47. package/dist/cjs/ab-experiment/constants/index.js.map +0 -1
  48. package/dist/cjs/ab-experiment/index.d.ts +0 -2
  49. package/dist/cjs/ab-experiment/index.js +0 -15
  50. package/dist/cjs/ab-experiment/index.js.map +0 -1
  51. package/dist/cjs/ab-experiment/utils/ab-variant.d.ts +0 -13
  52. package/dist/cjs/ab-experiment/utils/ab-variant.js +0 -125
  53. package/dist/cjs/ab-experiment/utils/ab-variant.js.map +0 -1
  54. package/dist/cjs/ab-experiment/utils/experiments.d.ts +0 -21
  55. package/dist/cjs/ab-experiment/utils/experiments.js +0 -95
  56. package/dist/cjs/ab-experiment/utils/experiments.js.map +0 -1
  57. package/dist/cjs/analytics/attributes.d.ts +0 -10
  58. package/dist/cjs/analytics/attributes.js +0 -33
  59. package/dist/cjs/analytics/attributes.js.map +0 -1
  60. package/dist/cjs/analytics/data-props.d.ts +0 -3
  61. package/dist/cjs/analytics/data-props.js +0 -20
  62. package/dist/cjs/analytics/data-props.js.map +0 -1
  63. package/dist/cjs/analytics/index.d.ts +0 -2
  64. package/dist/cjs/analytics/index.js +0 -19
  65. package/dist/cjs/analytics/index.js.map +0 -1
  66. package/dist/cjs/constants/analytics/index.d.ts +0 -8
  67. package/dist/cjs/constants/analytics/index.js +0 -12
  68. package/dist/cjs/constants/analytics/index.js.map +0 -1
  69. package/dist/cjs/constants/country/country-code-map.d.ts +0 -9
  70. package/dist/cjs/constants/country/country-code-map.js +0 -997
  71. package/dist/cjs/constants/country/country-code-map.js.map +0 -1
  72. package/dist/cjs/constants/country/country-region-map.d.ts +0 -12
  73. package/dist/cjs/constants/country/country-region-map.js +0 -202
  74. package/dist/cjs/constants/country/country-region-map.js.map +0 -1
  75. package/dist/cjs/constants/country/index.d.ts +0 -5
  76. package/dist/cjs/constants/country/index.js +0 -24
  77. package/dist/cjs/constants/country/index.js.map +0 -1
  78. package/dist/cjs/constants/country/iso-country-code.d.ts +0 -248
  79. package/dist/cjs/constants/country/iso-country-code.js +0 -252
  80. package/dist/cjs/constants/country/iso-country-code.js.map +0 -1
  81. package/dist/cjs/constants/country/region.d.ts +0 -10
  82. package/dist/cjs/constants/country/region.js +0 -14
  83. package/dist/cjs/constants/country/region.js.map +0 -1
  84. package/dist/cjs/constants/country/states.d.ts +0 -8
  85. package/dist/cjs/constants/country/states.js +0 -103
  86. package/dist/cjs/constants/country/states.js.map +0 -1
  87. package/dist/cjs/constants/currency-symbols/index.d.ts +0 -175
  88. package/dist/cjs/constants/currency-symbols/index.js +0 -179
  89. package/dist/cjs/constants/currency-symbols/index.js.map +0 -1
  90. package/dist/cjs/constants/date-time/index.d.ts +0 -18
  91. package/dist/cjs/constants/date-time/index.js +0 -44
  92. package/dist/cjs/constants/date-time/index.js.map +0 -1
  93. package/dist/cjs/constants/date-time/international-timezones.d.ts +0 -7
  94. package/dist/cjs/constants/date-time/international-timezones.js +0 -160
  95. package/dist/cjs/constants/date-time/international-timezones.js.map +0 -1
  96. package/dist/cjs/constants/index.d.ts +0 -5
  97. package/dist/cjs/constants/index.js +0 -22
  98. package/dist/cjs/constants/index.js.map +0 -1
  99. package/dist/cjs/constants/instrumentation/index.d.ts +0 -5
  100. package/dist/cjs/constants/instrumentation/index.js +0 -9
  101. package/dist/cjs/constants/instrumentation/index.js.map +0 -1
  102. package/dist/cjs/constants/teacher/index.js +0 -277
  103. package/dist/cjs/constants/teacher/index.js.map +0 -1
  104. package/dist/cjs/cookie/index.d.ts +0 -4
  105. package/dist/cjs/cookie/index.js +0 -46
  106. package/dist/cjs/cookie/index.js.map +0 -1
  107. package/dist/cjs/country-code/index.d.ts +0 -8
  108. package/dist/cjs/country-code/index.js +0 -23
  109. package/dist/cjs/country-code/index.js.map +0 -1
  110. package/dist/cjs/data/utm-source.json +0 -54
  111. package/dist/cjs/date-time-helper/index.d.ts +0 -30
  112. package/dist/cjs/date-time-helper/index.js +0 -107
  113. package/dist/cjs/date-time-helper/index.js.map +0 -1
  114. package/dist/cjs/e-cna/index.d.ts +0 -4
  115. package/dist/cjs/e-cna/index.js +0 -22
  116. package/dist/cjs/e-cna/index.js.map +0 -1
  117. package/dist/cjs/growth-source/index.d.ts +0 -21
  118. package/dist/cjs/growth-source/index.js +0 -235
  119. package/dist/cjs/growth-source/index.js.map +0 -1
  120. package/dist/cjs/growth-source/scripts/source-channel.d.ts +0 -1
  121. package/dist/cjs/growth-source/scripts/source-channel.js +0 -44
  122. package/dist/cjs/growth-source/scripts/source-channel.js.map +0 -1
  123. package/dist/cjs/growth-source/types.d.ts +0 -75
  124. package/dist/cjs/growth-source/types.js +0 -3
  125. package/dist/cjs/growth-source/types.js.map +0 -1
  126. package/dist/cjs/index.d.ts +0 -17
  127. package/dist/cjs/index.js +0 -35
  128. package/dist/cjs/index.js.map +0 -1
  129. package/dist/cjs/last-landing-page/index.d.ts +0 -5
  130. package/dist/cjs/last-landing-page/index.js +0 -34
  131. package/dist/cjs/last-landing-page/index.js.map +0 -1
  132. package/dist/cjs/local-storage/index.d.ts +0 -13
  133. package/dist/cjs/local-storage/index.js +0 -173
  134. package/dist/cjs/local-storage/index.js.map +0 -1
  135. package/dist/cjs/object/index.d.ts +0 -2
  136. package/dist/cjs/object/index.js +0 -24
  137. package/dist/cjs/object/index.js.map +0 -1
  138. package/dist/cjs/script/index.d.ts +0 -1
  139. package/dist/cjs/script/index.js +0 -14
  140. package/dist/cjs/script/index.js.map +0 -1
  141. package/dist/cjs/url/index.d.ts +0 -3
  142. package/dist/cjs/url/index.js +0 -10
  143. package/dist/cjs/url/index.js.map +0 -1
  144. package/dist/cjs/url-parser/index.d.ts +0 -3
  145. package/dist/cjs/url-parser/index.js +0 -13
  146. package/dist/cjs/url-parser/index.js.map +0 -1
  147. package/dist/cjs/utils/env-mode.d.ts +0 -5
  148. package/dist/cjs/utils/env-mode.js +0 -9
  149. package/dist/cjs/utils/env-mode.js.map +0 -1
  150. package/dist/cjs/utils/index.d.ts +0 -2
  151. package/dist/cjs/utils/index.js +0 -19
  152. package/dist/cjs/utils/index.js.map +0 -1
  153. package/dist/cjs/utils/server.d.ts +0 -1
  154. package/dist/cjs/utils/server.js +0 -5
  155. package/dist/cjs/utils/server.js.map +0 -1
  156. package/dist/cjs/validations/form-validations.d.ts +0 -12
  157. package/dist/cjs/validations/form-validations.js +0 -47
  158. package/dist/cjs/validations/form-validations.js.map +0 -1
  159. package/dist/cjs/validations/index.d.ts +0 -1
  160. package/dist/cjs/validations/index.js +0 -18
  161. package/dist/cjs/validations/index.js.map +0 -1
  162. package/dist/cjs/website-category/constants/index.d.ts +0 -116
  163. package/dist/cjs/website-category/constants/index.js +0 -230
  164. package/dist/cjs/website-category/constants/index.js.map +0 -1
  165. package/dist/cjs/website-category/constants/instrumentation.d.ts +0 -178
  166. package/dist/cjs/website-category/constants/instrumentation.js +0 -182
  167. package/dist/cjs/website-category/constants/instrumentation.js.map +0 -1
  168. package/dist/cjs/website-category/index.d.ts +0 -3
  169. package/dist/cjs/website-category/index.js +0 -14
  170. package/dist/cjs/website-category/index.js.map +0 -1
  171. package/dist/cjs/website-category/utils/index.d.ts +0 -1
  172. package/dist/cjs/website-category/utils/index.js +0 -10
  173. package/dist/cjs/website-category/utils/index.js.map +0 -1
  174. package/dist/cjs/website-category/utils/instrumentation.d.ts +0 -8
  175. package/dist/cjs/website-category/utils/instrumentation.js +0 -70
  176. package/dist/cjs/website-category/utils/instrumentation.js.map +0 -1
  177. package/dist/esm/ab-experiment/constants/index.d.ts +0 -64
  178. package/dist/esm/ab-experiment/constants/index.js +0 -65
  179. package/dist/esm/ab-experiment/constants/index.js.map +0 -1
  180. package/dist/esm/ab-experiment/index.d.ts +0 -2
  181. package/dist/esm/ab-experiment/index.js +0 -3
  182. package/dist/esm/ab-experiment/index.js.map +0 -1
  183. package/dist/esm/ab-experiment/utils/ab-variant.d.ts +0 -13
  184. package/dist/esm/ab-experiment/utils/ab-variant.js +0 -117
  185. package/dist/esm/ab-experiment/utils/ab-variant.js.map +0 -1
  186. package/dist/esm/ab-experiment/utils/experiments.d.ts +0 -21
  187. package/dist/esm/ab-experiment/utils/experiments.js +0 -92
  188. package/dist/esm/ab-experiment/utils/experiments.js.map +0 -1
  189. package/dist/esm/analytics/attributes.d.ts +0 -10
  190. package/dist/esm/analytics/attributes.js +0 -29
  191. package/dist/esm/analytics/attributes.js.map +0 -1
  192. package/dist/esm/analytics/data-props.d.ts +0 -3
  193. package/dist/esm/analytics/data-props.js +0 -17
  194. package/dist/esm/analytics/data-props.js.map +0 -1
  195. package/dist/esm/analytics/index.d.ts +0 -2
  196. package/dist/esm/analytics/index.js +0 -3
  197. package/dist/esm/analytics/index.js.map +0 -1
  198. package/dist/esm/constants/analytics/index.d.ts +0 -8
  199. package/dist/esm/constants/analytics/index.js +0 -9
  200. package/dist/esm/constants/analytics/index.js.map +0 -1
  201. package/dist/esm/constants/country/country-code-map.d.ts +0 -9
  202. package/dist/esm/constants/country/country-code-map.js +0 -994
  203. package/dist/esm/constants/country/country-code-map.js.map +0 -1
  204. package/dist/esm/constants/country/country-region-map.d.ts +0 -12
  205. package/dist/esm/constants/country/country-region-map.js +0 -199
  206. package/dist/esm/constants/country/country-region-map.js.map +0 -1
  207. package/dist/esm/constants/country/index.d.ts +0 -5
  208. package/dist/esm/constants/country/index.js +0 -6
  209. package/dist/esm/constants/country/index.js.map +0 -1
  210. package/dist/esm/constants/country/iso-country-code.d.ts +0 -248
  211. package/dist/esm/constants/country/iso-country-code.js +0 -249
  212. package/dist/esm/constants/country/iso-country-code.js.map +0 -1
  213. package/dist/esm/constants/country/region.d.ts +0 -10
  214. package/dist/esm/constants/country/region.js +0 -11
  215. package/dist/esm/constants/country/region.js.map +0 -1
  216. package/dist/esm/constants/country/states.d.ts +0 -8
  217. package/dist/esm/constants/country/states.js +0 -100
  218. package/dist/esm/constants/country/states.js.map +0 -1
  219. package/dist/esm/constants/currency-symbols/index.d.ts +0 -175
  220. package/dist/esm/constants/currency-symbols/index.js +0 -176
  221. package/dist/esm/constants/currency-symbols/index.js.map +0 -1
  222. package/dist/esm/constants/date-time/index.d.ts +0 -18
  223. package/dist/esm/constants/date-time/index.js +0 -40
  224. package/dist/esm/constants/date-time/index.js.map +0 -1
  225. package/dist/esm/constants/date-time/international-timezones.d.ts +0 -7
  226. package/dist/esm/constants/date-time/international-timezones.js +0 -153
  227. package/dist/esm/constants/date-time/international-timezones.js.map +0 -1
  228. package/dist/esm/constants/index.d.ts +0 -5
  229. package/dist/esm/constants/index.js +0 -6
  230. package/dist/esm/constants/index.js.map +0 -1
  231. package/dist/esm/constants/instrumentation/index.d.ts +0 -5
  232. package/dist/esm/constants/instrumentation/index.js +0 -6
  233. package/dist/esm/constants/instrumentation/index.js.map +0 -1
  234. package/dist/esm/constants/teacher/index.js +0 -273
  235. package/dist/esm/constants/teacher/index.js.map +0 -1
  236. package/dist/esm/cookie/index.d.ts +0 -4
  237. package/dist/esm/cookie/index.js +0 -39
  238. package/dist/esm/cookie/index.js.map +0 -1
  239. package/dist/esm/country-code/index.d.ts +0 -8
  240. package/dist/esm/country-code/index.js +0 -19
  241. package/dist/esm/country-code/index.js.map +0 -1
  242. package/dist/esm/data/utm-source.json +0 -54
  243. package/dist/esm/date-time-helper/index.d.ts +0 -30
  244. package/dist/esm/date-time-helper/index.js +0 -87
  245. package/dist/esm/date-time-helper/index.js.map +0 -1
  246. package/dist/esm/e-cna/index.d.ts +0 -4
  247. package/dist/esm/e-cna/index.js +0 -18
  248. package/dist/esm/e-cna/index.js.map +0 -1
  249. package/dist/esm/growth-source/index.d.ts +0 -21
  250. package/dist/esm/growth-source/index.js +0 -194
  251. package/dist/esm/growth-source/index.js.map +0 -1
  252. package/dist/esm/growth-source/scripts/source-channel.d.ts +0 -1
  253. package/dist/esm/growth-source/scripts/source-channel.js +0 -44
  254. package/dist/esm/growth-source/scripts/source-channel.js.map +0 -1
  255. package/dist/esm/growth-source/types.d.ts +0 -75
  256. package/dist/esm/growth-source/types.js +0 -2
  257. package/dist/esm/growth-source/types.js.map +0 -1
  258. package/dist/esm/index.d.ts +0 -17
  259. package/dist/esm/index.js +0 -19
  260. package/dist/esm/index.js.map +0 -1
  261. package/dist/esm/last-landing-page/index.d.ts +0 -5
  262. package/dist/esm/last-landing-page/index.js +0 -31
  263. package/dist/esm/last-landing-page/index.js.map +0 -1
  264. package/dist/esm/local-storage/index.d.ts +0 -13
  265. package/dist/esm/local-storage/index.js +0 -162
  266. package/dist/esm/local-storage/index.js.map +0 -1
  267. package/dist/esm/object/index.d.ts +0 -2
  268. package/dist/esm/object/index.js +0 -19
  269. package/dist/esm/object/index.js.map +0 -1
  270. package/dist/esm/script/index.d.ts +0 -1
  271. package/dist/esm/script/index.js +0 -10
  272. package/dist/esm/script/index.js.map +0 -1
  273. package/dist/esm/url/index.d.ts +0 -3
  274. package/dist/esm/url/index.js +0 -6
  275. package/dist/esm/url/index.js.map +0 -1
  276. package/dist/esm/url-parser/index.d.ts +0 -3
  277. package/dist/esm/url-parser/index.js +0 -7
  278. package/dist/esm/url-parser/index.js.map +0 -1
  279. package/dist/esm/utils/env-mode.d.ts +0 -5
  280. package/dist/esm/utils/env-mode.js +0 -6
  281. package/dist/esm/utils/env-mode.js.map +0 -1
  282. package/dist/esm/utils/index.d.ts +0 -2
  283. package/dist/esm/utils/index.js +0 -3
  284. package/dist/esm/utils/index.js.map +0 -1
  285. package/dist/esm/utils/server.d.ts +0 -1
  286. package/dist/esm/utils/server.js +0 -2
  287. package/dist/esm/utils/server.js.map +0 -1
  288. package/dist/esm/validations/form-validations.d.ts +0 -12
  289. package/dist/esm/validations/form-validations.js +0 -43
  290. package/dist/esm/validations/form-validations.js.map +0 -1
  291. package/dist/esm/validations/index.d.ts +0 -1
  292. package/dist/esm/validations/index.js +0 -2
  293. package/dist/esm/validations/index.js.map +0 -1
  294. package/dist/esm/website-category/constants/index.d.ts +0 -116
  295. package/dist/esm/website-category/constants/index.js +0 -227
  296. package/dist/esm/website-category/constants/index.js.map +0 -1
  297. package/dist/esm/website-category/constants/instrumentation.d.ts +0 -178
  298. package/dist/esm/website-category/constants/instrumentation.js +0 -179
  299. package/dist/esm/website-category/constants/instrumentation.js.map +0 -1
  300. package/dist/esm/website-category/index.d.ts +0 -3
  301. package/dist/esm/website-category/index.js +0 -4
  302. package/dist/esm/website-category/index.js.map +0 -1
  303. package/dist/esm/website-category/utils/index.d.ts +0 -1
  304. package/dist/esm/website-category/utils/index.js +0 -6
  305. package/dist/esm/website-category/utils/index.js.map +0 -1
  306. package/dist/esm/website-category/utils/instrumentation.d.ts +0 -8
  307. package/dist/esm/website-category/utils/instrumentation.js +0 -63
  308. package/dist/esm/website-category/utils/instrumentation.js.map +0 -1
@@ -1,194 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { createCookie, getCookie, removeCookie } from '../cookie';
11
- import utmSourceSourceChannelData from '../data/utm-source.json';
12
- import { removeHrefLangFromPath } from '../url-parser';
13
- import { getSubRevenueChannel } from '../website-category';
14
- const SOURCE_DETAILS_COOKIE = 'source_details';
15
- export const readSourceCookie = () => {
16
- const sourceDetails = getCookie(SOURCE_DETAILS_COOKIE);
17
- return sourceDetails ? JSON.parse(decodeURIComponent(sourceDetails)) : undefined;
18
- };
19
- const writeSourceCookie = (sourceDetails) => {
20
- createCookie(SOURCE_DETAILS_COOKIE, JSON.stringify(sourceDetails), 365);
21
- };
22
- export const isSourcePresent = () => {
23
- return !!getCookie(SOURCE_DETAILS_COOKIE);
24
- };
25
- const updateSourceCookie = (currentSourceDetail) => {
26
- if (!isSourcePresent())
27
- return;
28
- const sourceDetails = readSourceCookie();
29
- if (sourceDetails === null || sourceDetails === void 0 ? void 0 : sourceDetails.current)
30
- delete sourceDetails.current; // Needed to be removed after current field remove from all user
31
- const updatedDetails = Object.assign(Object.assign({}, sourceDetails), currentSourceDetail);
32
- writeSourceCookie(updatedDetails);
33
- };
34
- const getRevenueChannel = (platform) => {
35
- let revenueChannel = 'unknown';
36
- // set defaults for WEBSITE and ASTRO
37
- if (platform === 'website') {
38
- revenueChannel = 'organic';
39
- }
40
- return revenueChannel;
41
- };
42
- /*
43
- if Platform = website, then decide based on experiment key
44
- if Platform = Astro, decide logic once BAU is started
45
- if Platform = APP, decide logic
46
- if Platform = chatbot, decide based on chatbot experiment key
47
- */
48
- const getFlow = (platform, experiments) => {
49
- let flow = 'regular';
50
- if (platform === 'website') {
51
- if (experiments) {
52
- const ecnaExp = Object.keys(experiments).find(experiment => experiment.indexOf('ecna') !== -1);
53
- flow = ecnaExp && experiments[ecnaExp] === 'b' ? 'e-cna' : 'regular';
54
- }
55
- }
56
- return flow;
57
- };
58
- const getFirstPage = () => {
59
- if (typeof window === undefined)
60
- return '';
61
- return removeHrefLangFromPath(window.location.pathname);
62
- };
63
- /*
64
- Set Static Source Details of user on Visit of Platform
65
- */
66
- export const initSourceDetails = ({ platform, experiments, // only for website.
67
- flow, revenueChannel, salesProcess, guestId, landingPage, referrer, sourceChannel, utmParams, lastLandingPage, product, }) => __awaiter(void 0, void 0, void 0, function* () {
68
- /*
69
- source cookie was added in cross subdomain for few days initially,
70
- which was later changed to subdomain specific. Now to sending older cookie to backend, removing older cookie
71
- */
72
- removeCookie(SOURCE_DETAILS_COOKIE, true);
73
- revenueChannel = revenueChannel || getRevenueChannel(platform);
74
- const firstPage = getFirstPage();
75
- if (!isSourcePresent()) {
76
- const sourceDetails = Object.assign({ platform_channel: platform, revenue_channel: revenueChannel, source_channel: sourceChannel, experiment_dict: experiments, flow: flow || getFlow(platform, experiments), sales_process: salesProcess, guest_id: guestId, referrer, utm_params: utmParams, product: product, signup_page: {
77
- url_path: firstPage,
78
- page_profile: getSubRevenueChannel(firstPage),
79
- timestamp: new Date(),
80
- } }, (platform !== 'astro' && {
81
- first_page: {
82
- url_path: firstPage,
83
- page_profile: getSubRevenueChannel(firstPage),
84
- timestamp: new Date(),
85
- },
86
- landing_page_24_hours: {
87
- url_path: lastLandingPage,
88
- page_profile: getSubRevenueChannel(lastLandingPage),
89
- timestamp: new Date(),
90
- },
91
- landing_page_session: {
92
- url_path: landingPage,
93
- page_profile: getSubRevenueChannel(landingPage),
94
- timestamp: new Date(),
95
- },
96
- }));
97
- writeSourceCookie(sourceDetails);
98
- }
99
- else {
100
- const updatedSource = Object.assign({ experiment_dict: experiments, flow: flow || getFlow(platform, experiments), guest_id: guestId, utm_params: utmParams }, (platform !== 'astro' && {
101
- landing_page_session: {
102
- url_path: landingPage,
103
- page_profile: getSubRevenueChannel(landingPage),
104
- timestamp: new Date(),
105
- },
106
- }));
107
- updateSourceCookie(updatedSource);
108
- }
109
- });
110
- // set Entry point where user clicked to Signup
111
- export const setFlowEntryPoint = (flowEntry) => __awaiter(void 0, void 0, void 0, function* () {
112
- updateSourceCookie({ flow_entry: flowEntry });
113
- });
114
- // set Entry point where user clicked to Signup
115
- export const setFlow = (flow) => __awaiter(void 0, void 0, void 0, function* () {
116
- updateSourceCookie({ flow });
117
- });
118
- export const setRevenueChannel = (revenueChannel) => __awaiter(void 0, void 0, void 0, function* () {
119
- updateSourceCookie({ revenue_channel: revenueChannel });
120
- });
121
- export const setSalesProcess = (salesProcess) => __awaiter(void 0, void 0, void 0, function* () {
122
- updateSourceCookie({ sales_process: salesProcess });
123
- });
124
- export const clearSalesProcess = () => __awaiter(void 0, void 0, void 0, function* () {
125
- updateSourceCookie({ sales_process: '' });
126
- });
127
- export const updateGuestId = (guestId) => __awaiter(void 0, void 0, void 0, function* () {
128
- updateSourceCookie({ guest_id: guestId });
129
- });
130
- export const setFirstPage = (pagePath) => __awaiter(void 0, void 0, void 0, function* () {
131
- updateSourceCookie({
132
- first_page: {
133
- url_path: pagePath,
134
- page_profile: getSubRevenueChannel(pagePath),
135
- timestamp: new Date(),
136
- },
137
- });
138
- });
139
- export const setPlatformChannel = (platformChannel) => __awaiter(void 0, void 0, void 0, function* () {
140
- updateSourceCookie({ platform_channel: platformChannel });
141
- });
142
- export const setLandingPage = (landingPage) => __awaiter(void 0, void 0, void 0, function* () {
143
- updateSourceCookie({
144
- landing_page_session: {
145
- url_path: landingPage,
146
- page_profile: getSubRevenueChannel(landingPage),
147
- timestamp: new Date(),
148
- },
149
- });
150
- });
151
- export const setSignupPage = (signupPage) => __awaiter(void 0, void 0, void 0, function* () {
152
- updateSourceCookie({
153
- signup_page: {
154
- url_path: signupPage,
155
- page_profile: getSubRevenueChannel(signupPage),
156
- timestamp: new Date(),
157
- },
158
- });
159
- });
160
- export const setLastLandingPage = (lastLandingPage, createdAt) => __awaiter(void 0, void 0, void 0, function* () {
161
- updateSourceCookie({
162
- landing_page_24_hours: {
163
- url_path: lastLandingPage,
164
- page_profile: getSubRevenueChannel(lastLandingPage),
165
- timestamp: createdAt || new Date(),
166
- },
167
- });
168
- });
169
- export const setReferrer = (referrer) => __awaiter(void 0, void 0, void 0, function* () {
170
- updateSourceCookie({ referrer });
171
- });
172
- export const setSourceChannel = (sourceChannel) => __awaiter(void 0, void 0, void 0, function* () {
173
- updateSourceCookie({ source_channel: sourceChannel });
174
- });
175
- export const setSignupForm = (signupForm) => __awaiter(void 0, void 0, void 0, function* () {
176
- updateSourceCookie({ signup_form: signupForm });
177
- });
178
- export const clearSignupForm = () => __awaiter(void 0, void 0, void 0, function* () {
179
- updateSourceCookie({ signup_form: {} });
180
- });
181
- export const setProduct = (product) => __awaiter(void 0, void 0, void 0, function* () {
182
- updateSourceCookie({ product });
183
- });
184
- export const getSourceChannel = (utmSource) => {
185
- const utmSourceMap = Object.assign({}, utmSourceSourceChannelData);
186
- if (!utmSource) {
187
- return 'others';
188
- }
189
- if (utmSourceMap[utmSource]) {
190
- return utmSourceMap[utmSource];
191
- }
192
- return 'others';
193
- };
194
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/growth-source/index.ts"],"names":[],"mappings":";;;;;;;;;AAUA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,0BAA0B,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAwB,EAAE;IACxD,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAEvD,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,aAAkC,EAAQ,EAAE;IACrE,YAAY,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAY,EAAE;IAC3C,OAAO,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AC;KACjB;IAED,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE;QAC3B,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;KAChC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,44 +0,0 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/no-var-requires */
3
- const fs = require('fs');
4
- const path = require('path');
5
- const csv = require('papaparse');
6
- const ClusterMetaInfoFileName = 'utm-source';
7
- (function csvFileToJSON() {
8
- const INPUT_FILE_PATH = path.resolve(__dirname, '.', `../../data/${ClusterMetaInfoFileName}.csv`);
9
- const OUTPUT_FILE_PATH = path.resolve(__dirname, '.', `../../data/${ClusterMetaInfoFileName}.json`);
10
- try {
11
- fs.readFile(INPUT_FILE_PATH, 'utf-8', (err, data) => {
12
- if (err)
13
- throw err;
14
- const options = {
15
- header: true,
16
- delimiter: ',',
17
- quoteChar: '"',
18
- escapeChar: '\\',
19
- };
20
- const jsonObj = csv.parse(data, options).data;
21
- let sourceChannelData = {};
22
- jsonObj.forEach(utmSourceChannelObject => {
23
- const { utm_source: utmSource, source_channel: sourceChannel } = utmSourceChannelObject || {};
24
- if (sourceChannelData[utmSource]) {
25
- throw new Error(`Duplicate utm_source Found ${utmSource}`);
26
- }
27
- sourceChannelData[utmSource] = sourceChannel;
28
- });
29
- const jsonString = JSON.stringify(sourceChannelData, null, 2);
30
- fs.writeFile(OUTPUT_FILE_PATH, jsonString, e => {
31
- if (e)
32
- throw e;
33
- // eslint-disable-next-line no-console
34
- console.log('CSV file converted to JSON');
35
- });
36
- });
37
- }
38
- catch (err) {
39
- // eslint-disable-next-line no-console
40
- console.log(err);
41
- process.exit(1);
42
- }
43
- })();
44
- //# sourceMappingURL=source-channel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-channel.js","sourceRoot":"","sources":["../../../../src/growth-source/scripts/source-channel.js"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,MAAM,E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iB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAE9D,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE;gBAC7C,IAAI,CAAC;oBAAE,MAAM,CAAC,CAAC;gBACf,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,EAAE,CAAC"}
@@ -1,75 +0,0 @@
1
- export type Platform = 'website' | 'app' | 'astro' | 'leap-teacher' | 'leap-admin';
2
- export type RevenueChannel = 'organic' | 'performance' | 'affiliate' | 'offline' | 'referral' | 'unknown';
3
- export type SignupFlow = 'regular' | 'e-cna' | 'e-sales' | 'e-cna-exit';
4
- export type OrganicChannel = 'seo-content' | 'seo-intent' | 'brand' | '';
5
- export type FlowEntry = 'chatbot' | 'sidebar-cta' | 'menu-cta' | 'onpage-banner' | 'pdf-download-cta' | 'bottom-static-cta';
6
- export type Experiments = Record<string, unknown>;
7
- export type UTMParams = {
8
- utm_source?: string;
9
- utm_medium?: string;
10
- utm_campaign?: string;
11
- utm_term?: string;
12
- utm_content?: string;
13
- utm_adcontent?: string;
14
- };
15
- export type UTMParamsKeys = keyof UTMParams;
16
- export type SignupForm = {
17
- form_id?: string;
18
- product?: string;
19
- process?: string;
20
- };
21
- export type PageProps = {
22
- url_path?: string;
23
- page_profile?: string;
24
- timestamp?: Date;
25
- };
26
- export type SourceDetailsCookie = {
27
- platform_channel: Platform;
28
- experiment_dict?: Experiments;
29
- flow?: SignupFlow;
30
- utm_params?: UTMParams;
31
- affiliate_channel?: string;
32
- offline_channel?: string;
33
- performance_channel?: string;
34
- revenue_channel: RevenueChannel;
35
- flow_entry?: string;
36
- first_page?: PageProps;
37
- signup_page?: PageProps;
38
- landing_page_24_hours?: PageProps;
39
- landing_page_session?: PageProps;
40
- last_page?: string;
41
- sales_process?: string;
42
- guest_id?: string;
43
- current?: Partial<SourceDetailsCookie>;
44
- landing_page?: string;
45
- referrer?: string;
46
- source_channel?: string;
47
- page_profile?: string;
48
- sub_platform?: string;
49
- current_page?: string;
50
- current_page_category?: string;
51
- signup_form?: SignupForm;
52
- product?: string;
53
- };
54
- export type SourceDetails = {
55
- platform: Platform;
56
- experiments?: Experiments;
57
- flow?: SignupFlow;
58
- utmParams?: UTMParams;
59
- affiliateChannel?: string;
60
- offlineChannel?: string;
61
- performanceChannel?: string;
62
- revenueChannel: RevenueChannel;
63
- flowEntry?: string;
64
- firstPage?: string;
65
- lastPage?: string;
66
- guestId?: string;
67
- salesProcess?: string;
68
- landingPage?: string;
69
- referrer?: string;
70
- sourceChannel?: string;
71
- pageProfile?: string;
72
- subPlatform?: string;
73
- lastLandingPage?: string;
74
- product?: string;
75
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/growth-source/types.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- export * from './cookie';
2
- export * from './constants';
3
- export * from './local-storage';
4
- export * from './date-time-helper';
5
- export * from './object';
6
- export * from './e-cna';
7
- export * from './utils';
8
- export * from './script';
9
- export * from './url';
10
- export * from './url-parser';
11
- export * from './validations';
12
- export * from './country-code';
13
- export * from './growth-source';
14
- export * from './analytics';
15
- export * from './ab-experiment';
16
- export * from './website-category';
17
- export * from './last-landing-page';
package/dist/esm/index.js DELETED
@@ -1,19 +0,0 @@
1
- export * from './cookie';
2
- export * from './constants';
3
- export * from './local-storage';
4
- export * from './date-time-helper';
5
- export * from './object';
6
- export * from './e-cna';
7
- export * from './utils';
8
- export * from './script';
9
- export * from './url';
10
- export * from './url-parser';
11
- export * from './validations';
12
- export * from './country-code';
13
- // below <package> to be removed from here and used and '@cuemath/web-utils/<package>' instead
14
- export * from './growth-source';
15
- export * from './analytics';
16
- export * from './ab-experiment';
17
- export * from './website-category';
18
- export * from './last-landing-page';
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAE/B,8FAA8F;AAC9F,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -1,5 +0,0 @@
1
- declare const getLastLandingPage: (requestUrl: string, currentLastLandingPage: any) => {
2
- isLastLandingPageUpdated: boolean;
3
- lastLandingPage: any;
4
- };
5
- export { getLastLandingPage };
@@ -1,31 +0,0 @@
1
- import { removeHrefLangFromPath, removeQueryStringFromPath } from '../url-parser';
2
- const ONE_DAY_IN_MILLI_SEC = 1 * 24 * 60 * 60 * 1000;
3
- const getLastLandingPage = (requestUrl, currentLastLandingPage) => {
4
- let isLastLandingPageUpdated = false;
5
- const updatedDetails = {
6
- value: removeHrefLangFromPath(removeQueryStringFromPath(requestUrl)),
7
- createdAt: new Date(),
8
- };
9
- let lastLandingPage = currentLastLandingPage
10
- ? JSON.parse(decodeURIComponent(currentLastLandingPage))
11
- : undefined;
12
- const { createdAt = '', value = '' } = lastLandingPage || {};
13
- if (!currentLastLandingPage || !value) {
14
- isLastLandingPageUpdated = true;
15
- lastLandingPage = updatedDetails;
16
- }
17
- else {
18
- const presentTimestamp = new Date();
19
- const createdAtTimestampInMiliseconds = (createdAt && new Date(createdAt).getTime()) || 0;
20
- const presentTimestampInMiliseconds = presentTimestamp.getTime();
21
- const isCookieNeedToBeUpdated = presentTimestampInMiliseconds - createdAtTimestampInMiliseconds >=
22
- ONE_DAY_IN_MILLI_SEC;
23
- if (isCookieNeedToBeUpdated) {
24
- isLastLandingPageUpdated = true;
25
- lastLandingPage = updatedDetails;
26
- }
27
- }
28
- return { isLastLandingPageUpdated, lastLandingPage };
29
- };
30
- export { getLastLandingPage };
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/last-landing-page/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAElF,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAErD,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAE,sBAA2B,EAAE,EAAE;IAC7E,IAAI,wBAAwB,GAAG,KAAK,CAAC;IACrC,MAAM,cAAc,GAAG;QACrB,KAAK,EAAE,sBAAsB,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;QACpE,SAAS,EAAE,IAAI,IAAI,EAAE;KACtB,CAAC;IAEF,IAAI,eAAe,GAAG,sBAAsB;QAC1C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;QACxD,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,eAAe,IAAI,EAAE,CAAC;IAE7D,IAAI,CAAC,sBAAsB,IAAI,CAAC,KAAK,EAAE;QACrC,wBAAwB,GAAG,IAAI,CAAC;QAChC,eAAe,GAAG,cAAc,CAAC;KAClC;SAAM;QACL,MAAM,gBAAgB,GAAG,IAAI,IAAI,EAAE,CAAC;QACpC,MAAM,+BAA+B,GACnC,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,6BAA6B,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAEjE,MAAM,uBAAuB,GAC3B,6BAA6B,GAAG,+BAA+B;YAC/D,oBAAoB,CAAC;QAEvB,IAAI,uBAAuB,EAAE;YAC3B,wBAAwB,GAAG,IAAI,CAAC;YAChC,eAAe,GAAG,cAAc,CAAC;SAClC;KACF;IAED,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,CAAC;AACvD,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,13 +0,0 @@
1
- export declare const LOCAL_STORAGE_PRIMARY_KEY = "CUEMATH_WEB";
2
- export declare const checkLocalStorageSupport: () => boolean;
3
- export declare const removeKeyFromObject: (obj: {
4
- [x: string]: any;
5
- }, keyToRemove: string) => {
6
- [x: string]: any;
7
- } | null;
8
- export declare const localStorageSet: (key: string | number, value: any, ttl?: number) => boolean;
9
- export declare const localStorageGet: (key: string) => null | string;
10
- export declare const localStorageGetAll: () => null | string;
11
- export declare const localStorageRemove: (key: string) => boolean;
12
- export declare const localStorageRemoveAll: () => boolean;
13
- export declare const removeExpiredKeysOnMount: () => boolean;
@@ -1,162 +0,0 @@
1
- import { TWENTY_FOUR_HOURS_IN_SECONDS } from '../constants/date-time';
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- export const LOCAL_STORAGE_PRIMARY_KEY = 'CUEMATH_WEB';
4
- export const checkLocalStorageSupport = () => {
5
- try {
6
- return 'localStorage' in window && window.localStorage !== null;
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
12
- export const removeKeyFromObject = (obj, keyToRemove) => {
13
- if (obj) {
14
- delete obj[keyToRemove];
15
- return obj;
16
- }
17
- return null;
18
- };
19
- // Default expiry set to 24 hours
20
- export const localStorageSet = (key, value, ttl = TWENTY_FOUR_HOURS_IN_SECONDS) => {
21
- if (checkLocalStorageSupport()) {
22
- try {
23
- let dbData = window.localStorage.getItem(LOCAL_STORAGE_PRIMARY_KEY);
24
- const now = new Date();
25
- const item = {
26
- value,
27
- expiry: now.getTime() + ttl,
28
- };
29
- if (dbData) {
30
- dbData = JSON.parse(dbData);
31
- dbData[key] = item;
32
- }
33
- else {
34
- dbData = { [key]: item };
35
- }
36
- window.localStorage.setItem(LOCAL_STORAGE_PRIMARY_KEY, JSON.stringify(dbData));
37
- return true;
38
- }
39
- catch (e) {
40
- return false;
41
- } // case when localStorage space quota is exceeded
42
- }
43
- else {
44
- return false;
45
- }
46
- };
47
- export const localStorageGet = (key) => {
48
- if (checkLocalStorageSupport()) {
49
- try {
50
- const primaryLocalStorageValue = window.localStorage.getItem(LOCAL_STORAGE_PRIMARY_KEY);
51
- let dbData = primaryLocalStorageValue != null
52
- ? JSON.parse(primaryLocalStorageValue)
53
- : primaryLocalStorageValue;
54
- const requestedData = dbData[key];
55
- const now = new Date();
56
- if (now.getTime() > requestedData.expiry) {
57
- dbData = removeKeyFromObject(dbData, key);
58
- window.localStorage.setItem(LOCAL_STORAGE_PRIMARY_KEY, JSON.stringify(dbData));
59
- return null;
60
- }
61
- return requestedData.value;
62
- }
63
- catch (e) {
64
- return null;
65
- }
66
- }
67
- else {
68
- return null;
69
- }
70
- };
71
- export const localStorageGetAll = () => {
72
- if (checkLocalStorageSupport()) {
73
- try {
74
- const primaryLocalStorageValue = window.localStorage.getItem(LOCAL_STORAGE_PRIMARY_KEY);
75
- return primaryLocalStorageValue != null
76
- ? JSON.parse(primaryLocalStorageValue)
77
- : primaryLocalStorageValue;
78
- }
79
- catch (e) {
80
- return null;
81
- }
82
- }
83
- else {
84
- return null;
85
- }
86
- };
87
- export const localStorageRemove = (key) => {
88
- if (checkLocalStorageSupport()) {
89
- try {
90
- const primaryLocalStorageValue = window.localStorage.getItem(LOCAL_STORAGE_PRIMARY_KEY);
91
- let dbData = primaryLocalStorageValue != null
92
- ? JSON.parse(primaryLocalStorageValue)
93
- : primaryLocalStorageValue;
94
- if (dbData[key]) {
95
- dbData = removeKeyFromObject(dbData, key);
96
- window.localStorage.setItem(LOCAL_STORAGE_PRIMARY_KEY, JSON.stringify(dbData));
97
- return true;
98
- }
99
- return false;
100
- }
101
- catch (e) {
102
- return false;
103
- }
104
- }
105
- else {
106
- return false;
107
- }
108
- };
109
- export const localStorageRemoveAll = () => {
110
- if (checkLocalStorageSupport()) {
111
- try {
112
- const primaryLocalStorageValue = window.localStorage.getItem(LOCAL_STORAGE_PRIMARY_KEY);
113
- const dbData = primaryLocalStorageValue != null
114
- ? JSON.parse(primaryLocalStorageValue)
115
- : primaryLocalStorageValue;
116
- if (dbData) {
117
- window.localStorage.removeItem(LOCAL_STORAGE_PRIMARY_KEY);
118
- return true;
119
- }
120
- return false;
121
- }
122
- catch (e) {
123
- return false;
124
- }
125
- }
126
- else {
127
- return false;
128
- }
129
- };
130
- export const removeExpiredKeysOnMount = () => {
131
- if (checkLocalStorageSupport()) {
132
- try {
133
- const primaryLocalStorageValue = window.localStorage.getItem(LOCAL_STORAGE_PRIMARY_KEY);
134
- let dbData = primaryLocalStorageValue != null
135
- ? JSON.parse(primaryLocalStorageValue)
136
- : primaryLocalStorageValue;
137
- const now = new Date();
138
- if (dbData) {
139
- dbData = Object.keys(dbData).reduce((accumulator, key) => {
140
- if (now.getTime() < dbData[key].expiry) {
141
- accumulator[key] = dbData[key];
142
- }
143
- return accumulator;
144
- }, {});
145
- }
146
- if (Object.keys(dbData).length) {
147
- window.localStorage.setItem(LOCAL_STORAGE_PRIMARY_KEY, JSON.stringify(dbData));
148
- }
149
- else {
150
- localStorageRemoveAll();
151
- }
152
- return true;
153
- }
154
- catch (e) {
155
- return false;
156
- }
157
- }
158
- else {
159
- return false;
160
- }
161
- };
162
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/local-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,uDAAuD;AACvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAY,EAAE;IACpD,IAAI;QACF,OAAO,cAAc,IAAI,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,IAAI,CAAC;KACjE;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAAyB,EACzB,WAAmB,EACU,EAAE;IAC/B,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,OAAO,GAAG,CAAC;KACZ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,iCAAiC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,GAAoB,EACpB,KAAU,EACV,GAAG,GAAG,4BAA4B,EACzB,EAAE;IACX,IAAI,wBAAwB,EAAE,EAAE;QAC9B,IAAI;YACF,IAAI,MAAM,GAAQ,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;YACzE,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YAEvB,MAAM,IAAI,GAAG;gBACX,KAAK;gBACL,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,GAAG;aAC5B,CAAC;YAEF,IAAI,MAAM,EAAE;gBACV,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;aACpB;iBAAM;gBACL,MAAM,GA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yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;aAChF;iBAAM;gBACL,qBAAqB,EAAE,CAAC;aACzB;YAED,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAC;SACd;KACF;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function isEmpty(obj: object): boolean;
2
- export declare function nestedMapsAreEqual(map1: Map<any, any>, map2: Map<any, any>): boolean;
@@ -1,19 +0,0 @@
1
- export function isEmpty(obj) {
2
- return Object.keys(obj).length === 0;
3
- }
4
- export function nestedMapsAreEqual(map1, map2) {
5
- // First, check if the maps have the same size
6
- if (map1.size !== map2.size) {
7
- return false;
8
- }
9
- // Then, iterate over each key-value pair in map1 and check if the corresponding key-value pair exists in map2
10
- for (const [key, value] of map1) {
11
- if (!map2.has(key) || map2.get(key) !== value) {
12
- // If the key doesn't exist in map2, or the value for the key is different, the maps are not equal
13
- return false;
14
- }
15
- }
16
- // If we haven't returned false by now, the maps are equal
17
- return true;
18
- }
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/object/index.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAmB,EAAE,IAAmB;IACzE,8CAA8C;IAC9C,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IAED,8GAA8G;IAC9G,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE;QAC/B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE;YAC7C,kGAAkG;YAClG,OAAO,KAAK,CAAC;SACd;KACF;IAED,0DAA0D;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1 +0,0 @@
1
- export declare const loadScript: (id: string, url: string, onLoad: (event: Event) => void, onError: (event: Event | string) => void) => void;
@@ -1,10 +0,0 @@
1
- export const loadScript = (id, url, onLoad, onError) => {
2
- const script = document.createElement('script');
3
- script.id = id;
4
- script.src = url;
5
- script.onload = onLoad;
6
- script.onerror = onError;
7
- script.async = true;
8
- document.body.appendChild(script);
9
- };
10
- //# sourceMappingURL=index.js.map