react-gldn-kit 0.1.1 → 0.1.2

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 (54) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/components/Banners/components/BannerTemplate/index.d.ts +2 -2
  3. package/dist/lib/components/Banners/types.d.ts +2 -2
  4. package/dist/lib/components/Modals/Alert/components/Auth/Credentials/index.d.ts +4 -0
  5. package/dist/lib/components/Modals/Alert/components/Auth/Credentials/index.js +57 -0
  6. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/CountrySelector/constants.d.ts +7 -0
  7. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/CountrySelector/constants.js +815 -0
  8. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/CountrySelector/index.d.ts +5 -0
  9. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/CountrySelector/index.js +35 -0
  10. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/CurrencySelector/index.d.ts +7 -0
  11. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/CurrencySelector/index.js +59 -0
  12. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/DocsCheckBox/index.d.ts +7 -0
  13. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/DocsCheckBox/index.js +35 -0
  14. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/EmailSignUp/index.d.ts +9 -0
  15. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/EmailSignUp/index.js +130 -0
  16. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/OneClickKit/index.d.ts +2 -0
  17. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/OneClickKit/index.js +60 -0
  18. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/Phone/constants.d.ts +2 -0
  19. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/Phone/constants.js +14 -0
  20. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/Phone/index.d.ts +5 -0
  21. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/Forms/Phone/index.js +129 -0
  22. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/PromoCode/index.d.ts +6 -0
  23. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/components/PromoCode/index.js +65 -0
  24. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/index.d.ts +9 -0
  25. package/dist/lib/components/Modals/Alert/components/Auth/SignUp/index.js +75 -0
  26. package/dist/lib/components/Modals/Alert/index.d.ts +3 -1
  27. package/dist/lib/components/Modals/Alert/index.js +16 -13
  28. package/dist/lib/components/ui/Headers/PopUpHeader/index.js +2 -1
  29. package/dist/lib/components/ui/Inputs/PhoneInput/index.d.ts +23 -0
  30. package/dist/lib/components/ui/Inputs/PhoneInput/index.js +125 -0
  31. package/dist/lib/components/ui/Tabs/index.js +2 -1
  32. package/dist/lib/hooks/useHookFabric.d.ts +6 -0
  33. package/dist/lib/hooks/useHookFabric.js +24 -0
  34. package/dist/lib/index.d.ts +9 -3
  35. package/dist/lib/index.js +34 -20
  36. package/dist/lib/utils/shared.d.ts +8 -0
  37. package/dist/lib/utils/shared.js +192 -0
  38. package/dist/lib/zustandStore/alerts/modal/constants.js +3 -3
  39. package/dist/lib/zustandStore/alerts/modal/store.js +3 -3
  40. package/dist/lib/zustandStore/forms/signUp/constants.d.ts +10 -0
  41. package/dist/lib/zustandStore/forms/signUp/constants.js +40 -0
  42. package/dist/lib/zustandStore/forms/signUp/selectors.d.ts +23 -0
  43. package/dist/lib/zustandStore/forms/signUp/selectors.js +84 -0
  44. package/dist/lib/zustandStore/forms/signUp/store.d.ts +2 -0
  45. package/dist/lib/zustandStore/forms/signUp/store.js +62 -0
  46. package/dist/lib/zustandStore/forms/signUp/types.d.ts +34 -0
  47. package/dist/lib/zustandStore/forms/signUp/types.js +10 -0
  48. package/dist/lib/zustandStore/forms/signUp/utils.d.ts +36 -0
  49. package/dist/lib/zustandStore/forms/signUp/utils.js +48 -0
  50. package/dist/lib/zustandStore/languages/selectors.d.ts +1 -1
  51. package/dist/main.css +223 -85
  52. package/package.json +8 -6
  53. package/dist/lib/zustandStore/alerts/modal/utils.d.ts +0 -2
  54. package/dist/lib/zustandStore/alerts/modal/utils.js +0 -11
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.copyToClipboard = exports.eraseCookie = exports.getCookie = exports.setCookie = exports.setExistingValueToCookie = exports.openExternalLink = exports.sleep = exports.getValueByIdFromUrl = void 0;
40
+ var store_1 = require("zustandStore/alerts/notification/store");
41
+ var types_1 = require("zustandStore/alerts/notification/types");
42
+ var getValueByIdFromUrl = function (key, path) {
43
+ var url = new URL(path);
44
+ var value = url.searchParams.get(key) || '';
45
+ return value;
46
+ };
47
+ exports.getValueByIdFromUrl = getValueByIdFromUrl;
48
+ var sleep = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
49
+ exports.sleep = sleep;
50
+ var openExternalLink = function (link, isNewWindow) {
51
+ if (isNewWindow === void 0) { isNewWindow = false; }
52
+ try {
53
+ var a = document.createElement('a');
54
+ a.href = link;
55
+ if (isNewWindow) {
56
+ a.target = '_blank';
57
+ }
58
+ a.click();
59
+ }
60
+ catch (err) {
61
+ console.info(err);
62
+ }
63
+ };
64
+ exports.openExternalLink = openExternalLink;
65
+ var setExistingValueToCookie = function (key, url) {
66
+ var value = (0, exports.getValueByIdFromUrl)(key, url);
67
+ if (value) {
68
+ setCookie(key, value, 28);
69
+ }
70
+ return value;
71
+ };
72
+ exports.setExistingValueToCookie = setExistingValueToCookie;
73
+ function setCookie(name, value, days) {
74
+ try {
75
+ var expires = '';
76
+ var date = new Date();
77
+ var convertDays = days * 24 * 60 * 60 * 1000;
78
+ date.setTime(date.getTime() + convertDays);
79
+ expires = 'expires=' + date.toUTCString();
80
+ if (process.env.NODE_ENV !== 'development') {
81
+ document.cookie = "".concat(name, "=").concat(value, ";").concat(expires, ";domain=.").concat(window.location.hostname, ";path=/");
82
+ return;
83
+ }
84
+ document.cookie = "".concat(name, "=").concat(value, ";").concat(expires, ";path=/");
85
+ }
86
+ catch (error) {
87
+ console.error('SET COOKIE :', error);
88
+ return;
89
+ }
90
+ }
91
+ exports.setCookie = setCookie;
92
+ function getCookie(name) {
93
+ try {
94
+ var nameEQ = name + '=';
95
+ var ca = document.cookie.split(';');
96
+ for (var i = 0; i < ca.length; i++) {
97
+ var c = ca[i];
98
+ while (c.charAt(0) === ' ') {
99
+ c = c.substring(1, c.length);
100
+ }
101
+ if (c.indexOf(nameEQ) === 0) {
102
+ return c.substring(nameEQ.length, c.length);
103
+ }
104
+ }
105
+ return null;
106
+ }
107
+ catch (error) {
108
+ console.error('🚀GET COOKIE :', error);
109
+ return null;
110
+ }
111
+ }
112
+ exports.getCookie = getCookie;
113
+ function eraseCookie(name) {
114
+ try {
115
+ var hostNames = window.location.hostname;
116
+ var url = process.env.NODE_ENV !== 'development' ? hostNames : 'localhost';
117
+ document.cookie =
118
+ name +
119
+ "=''; Path=/; domain=.".concat(url, "; Expires=Thu, 01 Jan 1970 00:00:01 GMT;");
120
+ }
121
+ catch (error) {
122
+ console.error('eraseCookie COOKIE :', error);
123
+ return;
124
+ }
125
+ }
126
+ exports.eraseCookie = eraseCookie;
127
+ var copyToClipboard = function (text) { return function () { return __awaiter(void 0, void 0, void 0, function () {
128
+ var err_1, textarea, successful;
129
+ var _a;
130
+ return __generator(this, function (_b) {
131
+ switch (_b.label) {
132
+ case 0:
133
+ _b.trys.push([0, 2, , 3]);
134
+ return [4 /*yield*/, navigator.clipboard.writeText(text)];
135
+ case 1:
136
+ _b.sent();
137
+ // @ts-ignore
138
+ (_a = window.ReactNativeWebView) === null || _a === void 0 ? void 0 : _a.postMessage(JSON.stringify({
139
+ type: 'copy-to-clipboard',
140
+ payload: {
141
+ text: text,
142
+ },
143
+ }));
144
+ store_1.useZustandNotificationKitStore.getState().addNotification({
145
+ uid: "copy_success_e+".concat(new Date().getTime()),
146
+ text: 'copied',
147
+ type: types_1.ENotificationType.Success,
148
+ });
149
+ return [3 /*break*/, 3];
150
+ case 2:
151
+ err_1 = _b.sent();
152
+ console.error('🚀 FAIL TO COPY #1:', err_1);
153
+ try {
154
+ textarea = document.createElement('textarea');
155
+ textarea.value = text;
156
+ textarea.setAttribute('readonly', '');
157
+ textarea.style.position = 'absolute';
158
+ textarea.style.left = '-9999px';
159
+ document.body.appendChild(textarea);
160
+ textarea.select();
161
+ try {
162
+ successful = document.execCommand('copy');
163
+ if (successful) {
164
+ console.log('Text copied');
165
+ }
166
+ else {
167
+ console.error('Failed to copy');
168
+ }
169
+ }
170
+ catch (err) {
171
+ console.error('Failed to copy', err);
172
+ }
173
+ document.body.removeChild(textarea);
174
+ store_1.useZustandNotificationKitStore.getState().addNotification({
175
+ uid: "copy_success_e+".concat(new Date().getTime()),
176
+ text: 'copied',
177
+ type: types_1.ENotificationType.Success,
178
+ });
179
+ }
180
+ catch (error) {
181
+ store_1.useZustandNotificationKitStore.getState().addNotification({
182
+ uid: "copy_failure+".concat(new Date().getTime()),
183
+ text: 'errors.copyFailure',
184
+ type: types_1.ENotificationType.Success,
185
+ });
186
+ }
187
+ return [3 /*break*/, 3];
188
+ case 3: return [2 /*return*/];
189
+ }
190
+ });
191
+ }); }; };
192
+ exports.copyToClipboard = copyToClipboard;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.INITIAL_MODAL_ADDITION_INFO = exports.INITIAL_MODAL = void 0;
4
+ var shared_1 = require("utils/shared");
4
5
  var types_1 = require("./types");
5
- var utils_1 = require("./utils");
6
6
  exports.INITIAL_MODAL = (function () {
7
7
  try {
8
- var value = (0, utils_1.getValueByIdFromUrl)('i-m', window.location.href);
8
+ var value = (0, shared_1.getValueByIdFromUrl)('i-m', window.location.href);
9
9
  if (value in types_1.EModalTypes) {
10
10
  return types_1.EModalTypes[value];
11
11
  }
@@ -17,7 +17,7 @@ exports.INITIAL_MODAL = (function () {
17
17
  })();
18
18
  exports.INITIAL_MODAL_ADDITION_INFO = (function () {
19
19
  try {
20
- var value = (0, utils_1.getValueByIdFromUrl)('i-m-a-i', window.location.href);
20
+ var value = (0, shared_1.getValueByIdFromUrl)('i-m-a-i', window.location.href);
21
21
  var keys = value.split(',');
22
22
  var obj_1 = {};
23
23
  keys.forEach(function (k) {
@@ -40,7 +40,7 @@ exports.useZustandModalKitStore = void 0;
40
40
  var zustand_1 = require("zustand");
41
41
  var types_1 = require("./types");
42
42
  var constants_1 = require("./constants");
43
- var utils_1 = require("./utils");
43
+ var index_1 = require("index");
44
44
  exports.useZustandModalKitStore = (0, zustand_1.create)(function (set, get) { return ({
45
45
  modalType: constants_1.INITIAL_MODAL,
46
46
  additionalInfo: constants_1.INITIAL_MODAL_ADDITION_INFO,
@@ -58,11 +58,11 @@ exports.useZustandModalKitStore = (0, zustand_1.create)(function (set, get) { re
58
58
  case 0:
59
59
  modalType = get().modalType;
60
60
  set({ oldType: modalType });
61
- return [4 /*yield*/, (0, utils_1.sleep)(100)];
61
+ return [4 /*yield*/, (0, index_1.sleep)(100)];
62
62
  case 1:
63
63
  _a.sent();
64
64
  set({ modalType: types_1.EModalTypes.CloseModal });
65
- return [4 /*yield*/, (0, utils_1.sleep)(500)];
65
+ return [4 /*yield*/, (0, index_1.sleep)(500)];
66
66
  case 2:
67
67
  _a.sent();
68
68
  set({ modalType: type, additionalInfo: additionalInfo });
@@ -0,0 +1,10 @@
1
+ import { ERegistrationForm } from './types';
2
+ export declare const REGISTRATION_UTM_MEDIUM = "utm_medium";
3
+ export declare const REGISTRATION_UTM_SOURCE = "utm_source";
4
+ export declare const REGISTRATION_UTM_CAMPAING = "utm_campaign";
5
+ export declare const REGISTRATION_CLICK_ID_CAMPAING = "clickid";
6
+ export declare const UTM_CONTENT = "utm_content";
7
+ export declare const SIGN_UP_URL_CURRENCY_NAME: string;
8
+ export declare const SIGN_UP_URL_COUNTRY_ID: number;
9
+ export declare const GET_AVAILABLE_REGISTRATION_FORM: ERegistrationForm[];
10
+ export declare const GET_INITIAL_REGISTRATION_FORM: ERegistrationForm;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET_INITIAL_REGISTRATION_FORM = exports.GET_AVAILABLE_REGISTRATION_FORM = exports.SIGN_UP_URL_COUNTRY_ID = exports.SIGN_UP_URL_CURRENCY_NAME = exports.UTM_CONTENT = exports.REGISTRATION_CLICK_ID_CAMPAING = exports.REGISTRATION_UTM_CAMPAING = exports.REGISTRATION_UTM_SOURCE = exports.REGISTRATION_UTM_MEDIUM = void 0;
4
+ var shared_1 = require("utils/shared");
5
+ var types_1 = require("./types");
6
+ exports.REGISTRATION_UTM_MEDIUM = 'utm_medium';
7
+ exports.REGISTRATION_UTM_SOURCE = 'utm_source';
8
+ exports.REGISTRATION_UTM_CAMPAING = 'utm_campaign';
9
+ exports.REGISTRATION_CLICK_ID_CAMPAING = 'clickid';
10
+ exports.UTM_CONTENT = 'utm_content';
11
+ exports.SIGN_UP_URL_CURRENCY_NAME = (0, shared_1.getValueByIdFromUrl)('currency', window.location.href);
12
+ exports.SIGN_UP_URL_COUNTRY_ID = +(0, shared_1.getValueByIdFromUrl)('countryId', window.location.href);
13
+ exports.GET_AVAILABLE_REGISTRATION_FORM = (function () {
14
+ try {
15
+ var value = (0, shared_1.getValueByIdFromUrl)('r-t', window.location.href);
16
+ var keys = value.split(',');
17
+ var availableRegistrationForm_1 = [];
18
+ keys.forEach(function (key) {
19
+ if (key in types_1.ERegistrationForm) {
20
+ availableRegistrationForm_1.push(types_1.ERegistrationForm[key]);
21
+ }
22
+ });
23
+ return availableRegistrationForm_1;
24
+ }
25
+ catch (error) {
26
+ return [];
27
+ }
28
+ })();
29
+ exports.GET_INITIAL_REGISTRATION_FORM = (function () {
30
+ try {
31
+ var value = (0, shared_1.getValueByIdFromUrl)('r-i-t', window.location.href);
32
+ if (value in types_1.ERegistrationForm && typeof value === 'string') {
33
+ return types_1.ERegistrationForm[value];
34
+ }
35
+ return null;
36
+ }
37
+ catch (error) {
38
+ return null;
39
+ }
40
+ })();
@@ -0,0 +1,23 @@
1
+ import { ERegistrationForm, ZustandRegistrationStore } from './types';
2
+ export declare const zustandRegistrationKitSelector: {
3
+ getAvailableCurrenciesSelector: (state: ZustandRegistrationStore) => import("./types").Currency[];
4
+ getAvailableRegistrationsSelector: (state: ZustandRegistrationStore) => ERegistrationForm[];
5
+ getRegisteredLoginSelector: (state: ZustandRegistrationStore) => string;
6
+ getRegistrationTabsSelector: (state: ZustandRegistrationStore) => {
7
+ label: string;
8
+ value: ERegistrationForm;
9
+ }[];
10
+ getActiveRegistrationFormSelector: (state: ZustandRegistrationStore) => ERegistrationForm;
11
+ getActiveCurrencyIdSelector: (state: ZustandRegistrationStore) => number;
12
+ getActiveCountryIdSelector: (state: ZustandRegistrationStore) => number;
13
+ getUtmMediumSelector: (state: ZustandRegistrationStore) => string;
14
+ getUtmSourceSelector: (state: ZustandRegistrationStore) => string;
15
+ getUtmCampaningSelector: (state: ZustandRegistrationStore) => string;
16
+ getUtmClickIdCampaningSelector: (state: ZustandRegistrationStore) => string;
17
+ getUtmContentSelector: (state: ZustandRegistrationStore) => string;
18
+ setAvailableCurrenciesAction: (state: ZustandRegistrationStore) => (currencies: import("./types").Currency[]) => void;
19
+ setActiveRegistrationFormAction: (state: ZustandRegistrationStore) => (t: ERegistrationForm) => void;
20
+ setActiveCurrencyIdAction: (state: ZustandRegistrationStore) => (c: number) => void;
21
+ setActiveCountryIdAction: (state: ZustandRegistrationStore) => (c: number) => void;
22
+ setRegisteredLoginAction: (state: ZustandRegistrationStore) => (c: string) => void;
23
+ };
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zustandRegistrationKitSelector = void 0;
4
+ var types_1 = require("./types");
5
+ var getAvailableCurrenciesSelector = function (state) {
6
+ return state.availableCurrencies;
7
+ };
8
+ var getAvailableRegistrationsSelector = function (state) {
9
+ return state.availableRegistrationForm;
10
+ };
11
+ var getRegisteredLoginSelector = function (state) {
12
+ return state.registeredLogin;
13
+ };
14
+ var getRegistrationTabsSelector = function (state) {
15
+ var types = getAvailableRegistrationsSelector(state);
16
+ return types.map(function (t) { return ({
17
+ label: t !== types_1.ERegistrationForm.PhoneWithoutCode
18
+ ? "registrations.tabs.".concat(types_1.ERegistrationForm[t])
19
+ : 'registrations.tabs.Phone',
20
+ value: t,
21
+ }); });
22
+ };
23
+ var getActiveRegistrationFormSelector = function (state) {
24
+ return state.activeForm;
25
+ };
26
+ var getActiveCurrencyIdSelector = function (state) {
27
+ return state.activeCurrencyId;
28
+ };
29
+ var getActiveCountryIdSelector = function (state) {
30
+ return state.activeCountryId;
31
+ };
32
+ // Tags
33
+ var getUtmMediumSelector = function (state) {
34
+ return state.utmMedium;
35
+ };
36
+ var getUtmSourceSelector = function (state) {
37
+ return state.utmSource;
38
+ };
39
+ var getUtmCampaningSelector = function (state) {
40
+ return state.utmCampaning;
41
+ };
42
+ var getUtmClickIdCampaningSelector = function (state) {
43
+ return state.clickIdCampaing;
44
+ };
45
+ var getUtmContentSelector = function (state) {
46
+ return state.utmContent;
47
+ };
48
+ // ================================= ACTIONS =================================
49
+ var setAvailableCurrenciesAction = function (state) {
50
+ return state.setCurrencies;
51
+ };
52
+ var setActiveRegistrationFormAction = function (state) {
53
+ return state.setActiveRegistrationForm;
54
+ };
55
+ var setActiveCurrencyIdAction = function (state) {
56
+ return state.setActiveCurrencyId;
57
+ };
58
+ var setActiveCountryIdAction = function (state) {
59
+ return state.setActiveCountryId;
60
+ };
61
+ var setRegisteredLoginAction = function (state) {
62
+ return state.setRegisteredLogin;
63
+ };
64
+ exports.zustandRegistrationKitSelector = {
65
+ getAvailableCurrenciesSelector: getAvailableCurrenciesSelector,
66
+ getAvailableRegistrationsSelector: getAvailableRegistrationsSelector,
67
+ getRegisteredLoginSelector: getRegisteredLoginSelector,
68
+ getRegistrationTabsSelector: getRegistrationTabsSelector,
69
+ getActiveRegistrationFormSelector: getActiveRegistrationFormSelector,
70
+ getActiveCurrencyIdSelector: getActiveCurrencyIdSelector,
71
+ getActiveCountryIdSelector: getActiveCountryIdSelector,
72
+ // Tags
73
+ getUtmMediumSelector: getUtmMediumSelector,
74
+ getUtmSourceSelector: getUtmSourceSelector,
75
+ getUtmCampaningSelector: getUtmCampaningSelector,
76
+ getUtmClickIdCampaningSelector: getUtmClickIdCampaningSelector,
77
+ getUtmContentSelector: getUtmContentSelector,
78
+ // Actions
79
+ setAvailableCurrenciesAction: setAvailableCurrenciesAction,
80
+ setActiveRegistrationFormAction: setActiveRegistrationFormAction,
81
+ setActiveCurrencyIdAction: setActiveCurrencyIdAction,
82
+ setActiveCountryIdAction: setActiveCountryIdAction,
83
+ setRegisteredLoginAction: setRegisteredLoginAction,
84
+ };
@@ -0,0 +1,2 @@
1
+ import { ZustandRegistrationStore } from './types';
2
+ export declare const useZustandRegistrationKitStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ZustandRegistrationStore>>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useZustandRegistrationKitStore = void 0;
4
+ var zustand_1 = require("zustand");
5
+ var types_1 = require("./types");
6
+ var constants_1 = require("./constants");
7
+ var shared_1 = require("utils/shared");
8
+ exports.useZustandRegistrationKitStore = (0, zustand_1.create)(function (set, get) { return ({
9
+ availableCurrencies: [],
10
+ availableRegistrationForm: constants_1.GET_AVAILABLE_REGISTRATION_FORM,
11
+ registeredLogin: '',
12
+ activeForm: constants_1.GET_INITIAL_REGISTRATION_FORM,
13
+ activeCurrencyId: null,
14
+ activeCountryId: constants_1.SIGN_UP_URL_COUNTRY_ID || null,
15
+ utmMedium: (0, shared_1.setExistingValueToCookie)(constants_1.REGISTRATION_UTM_MEDIUM, window.location.href),
16
+ utmSource: (0, shared_1.setExistingValueToCookie)(constants_1.REGISTRATION_UTM_SOURCE, window.location.href),
17
+ utmCampaning: '',
18
+ clickIdCampaing: (0, shared_1.setExistingValueToCookie)(constants_1.REGISTRATION_CLICK_ID_CAMPAING, window.location.href),
19
+ utmContent: (0, shared_1.setExistingValueToCookie)(constants_1.UTM_CONTENT, window.location.href),
20
+ setActiveCurrencyId: function (activeCurrencyId) {
21
+ set({ activeCurrencyId: activeCurrencyId });
22
+ },
23
+ setRegisteredLogin: function (registeredLogin) {
24
+ set({ registeredLogin: registeredLogin });
25
+ },
26
+ setActiveCountryId: function (activeCountryId) {
27
+ set({ activeCountryId: activeCountryId });
28
+ },
29
+ setAvailableRegistrationTypes: function (keys) {
30
+ // TODO: marketing forms
31
+ if (constants_1.GET_AVAILABLE_REGISTRATION_FORM.length) {
32
+ return;
33
+ }
34
+ var availableRegistrationForm = [];
35
+ keys.forEach(function (key) {
36
+ if (key in types_1.ERegistrationForm) {
37
+ availableRegistrationForm.push(types_1.ERegistrationForm[key]);
38
+ }
39
+ });
40
+ set({ availableRegistrationForm: availableRegistrationForm });
41
+ },
42
+ setActiveRegistrationForm: function (activeForm) {
43
+ set({ activeForm: activeForm, registeredLogin: '' });
44
+ },
45
+ setCurrencies: function (availableCurrencies) {
46
+ var _a;
47
+ if (!availableCurrencies.length) {
48
+ console.warn('PLACE PROVIDE REGISTRATION CURRENCIES');
49
+ return;
50
+ }
51
+ var activeCurrencyId = get().activeCurrencyId;
52
+ var newActiveCurrencyId = null;
53
+ if (!activeCurrencyId && constants_1.SIGN_UP_URL_CURRENCY_NAME) {
54
+ newActiveCurrencyId =
55
+ ((_a = availableCurrencies.find(function (c) {
56
+ return c.name.toLocaleLowerCase() ===
57
+ constants_1.SIGN_UP_URL_CURRENCY_NAME.toLocaleLowerCase();
58
+ })) === null || _a === void 0 ? void 0 : _a.id) || null;
59
+ }
60
+ set({ availableCurrencies: availableCurrencies, activeCurrencyId: newActiveCurrencyId });
61
+ },
62
+ }); });
@@ -0,0 +1,34 @@
1
+ export interface ZustandRegistrationStore extends ZustandRegistrationEntities {
2
+ setCurrencies: (currencies: Currency[]) => void;
3
+ setAvailableRegistrationTypes: (d: (keyof typeof ERegistrationForm)[]) => void;
4
+ setActiveRegistrationForm: (t: ERegistrationForm) => void;
5
+ setActiveCurrencyId: (c: number | null) => void;
6
+ setActiveCountryId: (c: number | null) => void;
7
+ setRegisteredLogin: (c: string) => void;
8
+ }
9
+ interface ZustandRegistrationEntities {
10
+ availableCurrencies: Currency[];
11
+ availableRegistrationForm: ERegistrationForm[];
12
+ activeForm: ERegistrationForm | null;
13
+ registeredLogin: string;
14
+ activeCurrencyId: number | null;
15
+ activeCountryId: number | null;
16
+ utmMedium: string;
17
+ utmSource: string;
18
+ utmCampaning: string;
19
+ clickIdCampaing: string;
20
+ utmContent: string;
21
+ }
22
+ export declare enum ERegistrationForm {
23
+ Email = 1,
24
+ Phone = 2,
25
+ OneClick = 3,
26
+ PhoneWithoutCode = 4
27
+ }
28
+ export type Currency = {
29
+ code: number;
30
+ id: number;
31
+ name: string;
32
+ shortView: string;
33
+ };
34
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERegistrationForm = void 0;
4
+ var ERegistrationForm;
5
+ (function (ERegistrationForm) {
6
+ ERegistrationForm[ERegistrationForm["Email"] = 1] = "Email";
7
+ ERegistrationForm[ERegistrationForm["Phone"] = 2] = "Phone";
8
+ ERegistrationForm[ERegistrationForm["OneClick"] = 3] = "OneClick";
9
+ ERegistrationForm[ERegistrationForm["PhoneWithoutCode"] = 4] = "PhoneWithoutCode";
10
+ })(ERegistrationForm = exports.ERegistrationForm || (exports.ERegistrationForm = {}));
@@ -0,0 +1,36 @@
1
+ import { ERequestIds, RegistrationSubType } from 'react-memory-optimization/dist/lib/binary/types';
2
+ type RegistrationDataProps = {
3
+ currencyId: number;
4
+ countryId: number;
5
+ countryName: string;
6
+ promoCode?: string;
7
+ registrationType: RegistrationSubType;
8
+ };
9
+ export declare const getRegistrationData: (props: RegistrationDataProps) => {
10
+ registrationType: RegistrationSubType;
11
+ appType: any;
12
+ currencyId: number;
13
+ countryName: string;
14
+ countryId: number;
15
+ gmt: number;
16
+ location: string;
17
+ promoCode: string;
18
+ utmMedium: string;
19
+ utmSource: string;
20
+ utmCampaign: string;
21
+ language: string;
22
+ clickId: string;
23
+ deviceType: import("../../..").EDeviceType;
24
+ requestId: ERequestIds;
25
+ };
26
+ export declare const getAuthorizationData: (at1: string, at2: string, requestId: ERequestIds) => {
27
+ at1: string;
28
+ at2: string;
29
+ location: string;
30
+ timeZone: number;
31
+ language: string;
32
+ userAgent: string;
33
+ appType: any;
34
+ requestId: ERequestIds;
35
+ };
36
+ export {};
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAuthorizationData = exports.getRegistrationData = void 0;
4
+ var types_1 = require("react-memory-optimization/dist/lib/binary/types");
5
+ var selectors_1 = require("zustandStore/device/selectors");
6
+ var store_1 = require("zustandStore/device/store");
7
+ var selectors_2 = require("zustandStore/languages/selectors");
8
+ var store_2 = require("zustandStore/languages/store");
9
+ var store_3 = require("./store");
10
+ var getRegistrationData = function (props) {
11
+ var currencyId = props.currencyId, countryId = props.countryId, countryName = props.countryName, registrationType = props.registrationType, _a = props.promoCode, promoCode = _a === void 0 ? '' : _a;
12
+ var langStore = store_2.useZustandLanguagesKitStore.getState();
13
+ var language = selectors_2.languageSelectors.getActiveLanguageNameKitSelector(langStore);
14
+ var deviceStore = store_1.useZustandDeviceKitStore.getState();
15
+ var deviceType = selectors_1.zustandDeviceKitSelector.getDeviceTypeSelector(deviceStore);
16
+ var _b = store_3.useZustandRegistrationKitStore.getState(), utmMedium = _b.utmMedium, utmSource = _b.utmSource, utmCampaning = _b.utmCampaning, clickIdCampaing = _b.clickIdCampaing;
17
+ // utmContent
18
+ return {
19
+ registrationType: registrationType,
20
+ appType: window.APP_TYPE,
21
+ currencyId: currencyId,
22
+ countryName: countryName,
23
+ countryId: countryId,
24
+ gmt: Math.floor((new Date().getTimezoneOffset() / 60) * -1),
25
+ location: "".concat(window.location.href),
26
+ promoCode: promoCode.toUpperCase(),
27
+ utmMedium: utmMedium,
28
+ utmSource: utmSource,
29
+ utmCampaign: utmCampaning,
30
+ language: language,
31
+ clickId: clickIdCampaing,
32
+ // TODO dynamic
33
+ deviceType: deviceType,
34
+ requestId: types_1.ERequestIds.Registration,
35
+ };
36
+ };
37
+ exports.getRegistrationData = getRegistrationData;
38
+ var getAuthorizationData = function (at1, at2, requestId) { return ({
39
+ at1: at1,
40
+ at2: at2,
41
+ location: "".concat(window.location.href),
42
+ timeZone: Math.floor(new Date().getTimezoneOffset() / -60),
43
+ language: selectors_2.languageSelectors.getActiveLanguageNameKitSelector(store_2.useZustandLanguagesKitStore.getState()),
44
+ userAgent: window.navigator.userAgent,
45
+ appType: window.APP_TYPE,
46
+ requestId: requestId,
47
+ }); };
48
+ exports.getAuthorizationData = getAuthorizationData;
@@ -12,7 +12,7 @@ export declare const languageSelectors: {
12
12
  };
13
13
  getAndSetLanguagesKitAction: (state: ZustandLanguageStoreKit) => (lang: string, path: string) => void;
14
14
  getBrandNameKitSelector: (state: ZustandLanguageStoreKit) => "Unknown" | "Azure" | "Elon" | "XXX" | "Opera" | "FsWin" | "JabiBet" | "SlothBets" | "M1";
15
- setInitialLanguageKitAction: (state: ZustandLanguageStoreKit) => (appType: import("../../types/ui").EAppType, initialLang: string, path: string) => void;
15
+ setInitialLanguageKitAction: (state: ZustandLanguageStoreKit) => (appType: import("../..").EAppType, initialLang: string, path: string) => void;
16
16
  setLanguagesKitAction: (state: ZustandLanguageStoreKit) => (lang: {
17
17
  name: string;
18
18
  dictionary: {