@tap-payments/auth-jsconnect 2.8.87-development → 2.8.88-development

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.
@@ -22,6 +22,13 @@ type BrandTitle = {
22
22
  ar?: string;
23
23
  zh?: string;
24
24
  };
25
+ type MetaData = {
26
+ utm_source?: string;
27
+ utm_medium?: string;
28
+ utm_campaign?: string;
29
+ utm_term?: string;
30
+ utm_content?: string;
31
+ };
25
32
  type BrandContent = {
26
33
  tag_line?: BrandTitle;
27
34
  about?: BrandTitle;
@@ -49,9 +56,7 @@ export type UpdateLeadBody = {
49
56
  business_type?: string;
50
57
  country_code?: string;
51
58
  brand?: BrandInfo;
52
- metadata?: {
53
- check: string;
54
- };
59
+ metadata?: MetaData;
55
60
  note?: string;
56
61
  source?: {
57
62
  business_id?: string;
@@ -71,7 +71,7 @@ import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2
71
71
  import { CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_BRAND } from '../../../constants';
72
72
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
73
73
  import { AuthForType, FlowsTypes } from '../../../@types';
74
- import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2 } from '../../../utils';
74
+ import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData } from '../../../utils';
75
75
  export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
76
76
  var connect, payload, data;
77
77
  return __generator(this, function (_a) {
@@ -457,6 +457,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
457
457
  country_code: (_d = settings.data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2,
458
458
  name: getIndividualName(params.name),
459
459
  contact: __assign({ email: params.email }, (params.mobile && { phone: { country_code: phoneCountry, number: params.mobile } })),
460
+ metadata: getMetaData(),
460
461
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
461
462
  encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number']
462
463
  };
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@ty
61
61
  import API from '../../../api';
62
62
  import { ADD_NEW_ENTITY, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension } from '../../../utils';
64
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData } from '../../../utils';
65
65
  export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var connectExpress, payload, data;
67
67
  return __generator(this, function (_a) {
@@ -977,7 +977,7 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
977
977
  isContactAvailable = email || mobile;
978
978
  payload = __assign(__assign({ id: id || '', country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2, name: getIndividualName(name) }, (isContactAvailable && {
979
979
  contact: __assign({ email: email }, (mobile && { phone: { country_code: phoneCountry, number: mobile } }))
980
- })), { step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL, encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number'] });
980
+ })), { metadata: getMetaData(), step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL, encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number'] });
981
981
  return [4, API.leadService.updateLeadExpress(payload)];
982
982
  case 1:
983
983
  data = _h.sent();
@@ -3,3 +3,4 @@ export declare const dangerousMessage: (message: string, callBack?: Function) =>
3
3
  export declare const setBaseUrl: (publicKey: string) => void;
4
4
  export declare const updateLocationUrlWithCountry: (countryIso2: string) => void;
5
5
  export declare const openConnect: (pk: string, countryCode?: string) => void;
6
+ export declare function getMetaData(): Record<string, string> | undefined;
@@ -1,5 +1,6 @@
1
1
  import { axiosInstance } from '../api';
2
2
  import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
3
+ import { objectHasValues } from './object';
3
4
  export var sleep = function (milliseconds) {
4
5
  if (milliseconds === void 0) { milliseconds = 1000; }
5
6
  return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
@@ -41,3 +42,15 @@ export var openConnect = function (pk, countryCode) {
41
42
  }
42
43
  window.open("".concat(newUrl), '_self', '_blank');
43
44
  };
45
+ export function getMetaData() {
46
+ var urlObj = new URL(window.location.href);
47
+ var paramsToExtract = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
48
+ var meta_data = {};
49
+ paramsToExtract.forEach(function (param) {
50
+ var value = urlObj.searchParams.get(param);
51
+ if (value !== null && value !== '') {
52
+ meta_data[param] = value;
53
+ }
54
+ });
55
+ return objectHasValues(meta_data) ? meta_data : undefined;
56
+ }
@@ -8,3 +8,4 @@ export declare const hasNoneEditableValue: (obj: any, path: string) => boolean;
8
8
  export declare const hasEditableValue: (obj: any, path: string) => boolean;
9
9
  export declare const hasVerifiedValue: (obj: any, path: string) => boolean;
10
10
  export declare function deepCopy(obj: any): any;
11
+ export declare function objectHasValues(obj: Record<string, any>): boolean;
@@ -64,3 +64,6 @@ export function deepCopy(obj) {
64
64
  }
65
65
  return newObj;
66
66
  }
67
+ export function objectHasValues(obj) {
68
+ return Object.keys(obj).length > 0;
69
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.87-development",
3
+ "version": "2.8.88-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",