@deriv-com/analytics 1.5.2 → 1.5.4

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.
@@ -10,7 +10,7 @@ type Options = {
10
10
  };
11
11
  export declare function createAnalyticsInstance(options?: Options): {
12
12
  initialise: ({ growthbookKey, growthbookDecryptionKey, rudderstackKey, growthbookOptions }: Options) => void;
13
- setAttributes: ({ country, user_language, device_language, device_type, account_type, user_id, app_id, utm_source, utm_medium, utm_campaign, is_authorised, url, }: TCoreAttributes) => void;
13
+ setAttributes: ({ country, user_language, device_language, device_type, account_type, user_id, app_id, utm_source, utm_medium, utm_campaign, is_authorised, url, domain, }: TCoreAttributes) => void;
14
14
  identifyEvent: () => void;
15
15
  getFeatureState: (id: string) => string | undefined;
16
16
  getFeatureValue: <K extends string | number, V extends GrowthbookConfigs[K]>(id: K, defaultValue: V) => import("@growthbook/growthbook").WidenPrimitives<V>;
@@ -27,7 +27,7 @@ export declare function createAnalyticsInstance(options?: Options): {
27
27
  };
28
28
  export declare const Analytics: {
29
29
  initialise: ({ growthbookKey, growthbookDecryptionKey, rudderstackKey, growthbookOptions }: Options) => void;
30
- setAttributes: ({ country, user_language, device_language, device_type, account_type, user_id, app_id, utm_source, utm_medium, utm_campaign, is_authorised, url, }: TCoreAttributes) => void;
30
+ setAttributes: ({ country, user_language, device_language, device_type, account_type, user_id, app_id, utm_source, utm_medium, utm_campaign, is_authorised, url, domain, }: TCoreAttributes) => void;
31
31
  identifyEvent: () => void;
32
32
  getFeatureState: (id: string) => string | undefined;
33
33
  getFeatureValue: <K extends string | number, V extends GrowthbookConfigs[K]>(id: K, defaultValue: V) => import("@growthbook/growthbook").WidenPrimitives<V>;
package/lib/analytics.js CHANGED
@@ -30,7 +30,7 @@ function createAnalyticsInstance(options) {
30
30
  }
31
31
  };
32
32
  var setAttributes = function (_a) {
33
- var country = _a.country, user_language = _a.user_language, device_language = _a.device_language, device_type = _a.device_type, account_type = _a.account_type, user_id = _a.user_id, app_id = _a.app_id, utm_source = _a.utm_source, utm_medium = _a.utm_medium, utm_campaign = _a.utm_campaign, is_authorised = _a.is_authorised, url = _a.url;
33
+ var country = _a.country, user_language = _a.user_language, device_language = _a.device_language, device_type = _a.device_type, account_type = _a.account_type, user_id = _a.user_id, app_id = _a.app_id, utm_source = _a.utm_source, utm_medium = _a.utm_medium, utm_campaign = _a.utm_campaign, is_authorised = _a.is_authorised, url = _a.url, domain = _a.domain;
34
34
  if (!_growthbook && !_rudderstack)
35
35
  return;
36
36
  var user_identity = user_id !== null && user_id !== void 0 ? user_id : getId();
@@ -47,9 +47,10 @@ function createAnalyticsInstance(options) {
47
47
  utm_campaign: utm_campaign,
48
48
  is_authorised: is_authorised,
49
49
  url: url,
50
+ domain: domain,
50
51
  });
51
52
  }
52
- core_data = __assign(__assign(__assign(__assign(__assign(__assign({}, (user_language !== undefined && { user_language: user_language })), (account_type !== undefined && { account_type: account_type })), (app_id !== undefined && { app_id: app_id })), (device_type !== undefined && { device_type: device_type })), (user_identity !== undefined && { user_identity: user_identity })), (url !== undefined && { url: url }));
53
+ core_data = __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, core_data), (user_language !== undefined && { user_language: user_language })), (account_type !== undefined && { account_type: account_type })), (app_id !== undefined && { app_id: app_id })), (device_type !== undefined && { device_type: device_type })), (user_identity !== undefined && { user_identity: user_identity })), (url !== undefined && { url: url }));
53
54
  };
54
55
  var getFeatureState = function (id) { var _a, _b; return (_b = (_a = _growthbook === null || _growthbook === void 0 ? void 0 : _growthbook.getFeatureState(id)) === null || _a === void 0 ? void 0 : _a.experimentResult) === null || _b === void 0 ? void 0 : _b.name; };
55
56
  var getFeatureValue = function (id, defaultValue) { return _growthbook === null || _growthbook === void 0 ? void 0 : _growthbook.getFeatureValue(id, defaultValue); };
@@ -10,7 +10,7 @@ export declare class Growthbook {
10
10
  private static _instance;
11
11
  constructor(clientKey: string, decryptionKey: string, settings?: Partial<Context>);
12
12
  static getGrowthBookInstance: (clientKey: string, decryptionKey: string, growthbookOptions?: Partial<Context>) => Growthbook;
13
- setAttributes: ({ id, country, user_language, device_language, device_type, utm_source, utm_medium, utm_campaign, is_authorised, url, }: TGrowthbookAttributes) => void;
13
+ setAttributes: ({ id, country, user_language, device_language, device_type, utm_source, utm_medium, utm_campaign, is_authorised, url, domain, utm_content, }: TGrowthbookAttributes) => void;
14
14
  getFeatureValue: <K extends string | number, V extends GrowthbookConfigs[K]>(key: K, defaultValue: V) => import("@growthbook/growthbook").WidenPrimitives<V>;
15
15
  getFeatureState: (id: string) => import("@growthbook/growthbook").FeatureResult<string | boolean | Record<string, boolean> | [] | null>;
16
16
  setUrl: (href: string) => Promise<void>;
package/lib/growthbook.js CHANGED
@@ -43,8 +43,9 @@ var Growthbook = /** @class */ (function () {
43
43
  if (settings === void 0) { settings = {}; }
44
44
  var _this = this;
45
45
  this.setAttributes = function (_a) {
46
- var id = _a.id, country = _a.country, user_language = _a.user_language, device_language = _a.device_language, device_type = _a.device_type, utm_source = _a.utm_source, utm_medium = _a.utm_medium, utm_campaign = _a.utm_campaign, is_authorised = _a.is_authorised, url = _a.url;
47
- _this.GrowthBook.setAttributes(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ id: id }, (country !== undefined && { country: country })), (user_language !== undefined && { user_language: user_language })), (device_language !== undefined && { device_language: device_language })), (device_type !== undefined && { device_type: device_type })), (utm_source !== undefined && { utm_source: utm_source })), (utm_medium !== undefined && { utm_medium: utm_medium })), (utm_campaign !== undefined && { utm_campaign: utm_campaign })), (is_authorised !== undefined && { is_authorised: is_authorised })), (url !== undefined && { url: url })));
46
+ var id = _a.id, country = _a.country, user_language = _a.user_language, device_language = _a.device_language, device_type = _a.device_type, utm_source = _a.utm_source, utm_medium = _a.utm_medium, utm_campaign = _a.utm_campaign, is_authorised = _a.is_authorised, url = _a.url, domain = _a.domain, utm_content = _a.utm_content;
47
+ var CURRENT_ATTRIBUTES = _this.GrowthBook.getAttributes();
48
+ _this.GrowthBook.setAttributes(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, CURRENT_ATTRIBUTES), { id: id }), (country !== undefined && { country: country })), (user_language !== undefined && { user_language: user_language })), (device_language !== undefined && { device_language: device_language })), (device_type !== undefined && { device_type: device_type })), (utm_source !== undefined && { utm_source: utm_source })), (utm_medium !== undefined && { utm_medium: utm_medium })), (utm_campaign !== undefined && { utm_campaign: utm_campaign })), (is_authorised !== undefined && { is_authorised: is_authorised })), (url !== undefined && { url: url })), (domain !== undefined && { domain: domain })), (utm_content !== undefined && { utm_content: utm_content })));
48
49
  };
49
50
  this.getFeatureValue = function (key, defaultValue) {
50
51
  return _this.GrowthBook.getFeatureValue(key, defaultValue);
package/lib/types.d.ts CHANGED
@@ -9,6 +9,8 @@ export type TGrowthbookAttributes = {
9
9
  utm_campaign?: string;
10
10
  is_authorised?: boolean;
11
11
  url?: string;
12
+ domain?: string;
13
+ utm_content?: string;
12
14
  };
13
15
  export type TCoreAttributes = {
14
16
  account_type?: string;
@@ -116,46 +118,21 @@ type TradeTypesForm = {
116
118
  form_name?: string;
117
119
  subform_name?: string;
118
120
  };
119
- type BotDashboardForm = {
120
- action?: 'open' | 'close' | 'search' | 'delete' | 'yes' | 'no' | 'search_string' | 'choose_shortcut' | 'bot_last_modified_time' | 'delete_popup_respond' | 'push_open_button' | 'push_user_guide' | 'save_your_bot' | 'edit_your_bot' | 'choose_your_bot' | 'delete_your_bot';
121
- shortcut_name?: string;
122
- form_source?: string;
123
- form_name?: string;
124
- search_string?: string;
125
- delete_popup_respond?: string;
126
- bot_last_modified_time?: number;
127
- bot_name?: string;
128
- bot_status?: string;
129
- preview_mode?: string;
130
- };
131
- type BotQuickStrategyForm = {
132
- action?: 'open' | 'close' | 'choose_strategy_type' | 'switch_strategy_mode' | 'choose_asset' | 'choose_trade_type' | 'choose_trade_type_mode' | 'choose_duration' | 'change_parameter_value' | 'info_popup_open' | 'run_strategy' | 'loss_threshold_warning_popup' | 'learn_more_expansion' | 'learn_more_collapse' | 'edit_strategy';
133
- form_source?: 'ce_bot_dashboard_form' | 'ce_bot_builder_form';
134
- form_name?: 'ce_bot_quick_strategy_form';
135
- strategy_type?: `d'alembert` | `martingale` | `oscar's-grind` | `reverse martingale` | `reverse d'alembert` | `1-3-2-6`;
136
- strategy_switcher_mode?: 'learn more' | 'trade parameters';
137
- asset_type?: string;
121
+ type BotForm = {
122
+ action?: 'open' | 'close' | 'search' | 'run_bot' | 'run_quick_strategy' | 'edit_quick_strategy' | 'select_quick_strategy_guide' | 'switch_quick_strategy_tab' | 'choose_strategy_type';
123
+ form_name?: 'ce_bot_form';
124
+ subpage_source?: 'dashboard' | 'bot_builder';
125
+ subpage_name?: 'tutorials' | 'bot_builder' | 'charts' | 'dashboard';
126
+ subform_name?: 'quick_strategy';
127
+ subform_source?: 'dashboard' | 'bot_builder';
128
+ quick_strategy_tab?: 'learn more' | 'trade parameters';
129
+ strategy_name?: `d'alembert` | `martingale` | `oscar's-grind` | `reverse martingale` | `reverse d'alembert` | `1-3-2-6`;
130
+ strategy_type?: 'custom' | 'quick_strategy';
131
+ search_term?: string;
132
+ asset?: string;
138
133
  trade_type?: string;
139
- trade_type_mode?: string;
140
- duration_type?: 'ticks' | 'seconds' | 'minutes' | 'hours' | 'days';
141
- parameter_type?: 'initial-stake' | 'duration' | 'profit-threshold' | 'loss-threshold' | 'size-unit' | 'max-stake' | string;
142
- parameter_field_type?: 'input' | 'dropdown' | 'slider' | 'checkbox' | 'number';
143
- parameter_value?: string | number | boolean;
144
- plus_minus_push?: 'yes' | 'no';
145
- manual_parameter_input?: 'yes' | 'no';
146
- dont_show_checkbox?: 'yes' | 'no';
147
- cta_name?: 'edit_the_amount' | 'yes_continue';
148
- learn_more_title?: string;
149
- };
150
- type BotBuilderForm = {
151
- action?: 'open' | 'close' | 'search';
152
- form_source?: 'bot_header_form' | 'bot_dashboard_form';
153
- search_string?: string;
154
- };
155
- type BotTutorialForm = {
156
- action?: 'open' | 'close' | 'search';
157
- form_source?: 'bot_header_form' | 'bot_dashboard_form-shortcut' | 'bot_dashboard_form-edit' | 'bot_dashboard_form-open';
158
- search_string?: string;
134
+ purchase_condition?: string;
135
+ initial_stake?: string;
159
136
  };
160
137
  type IndicatorsTypesFormAction = {
161
138
  action: 'open' | 'close' | 'add_active' | 'clean_all_active' | 'delete_active' | 'edit_active' | 'search' | 'info_open' | 'info_close';
@@ -276,10 +253,7 @@ export type TEvents = {
276
253
  ce_questionnaire_form: QuestionnaireForm;
277
254
  ce_partner_account_signup_form: PartnerAccountSignupForm;
278
255
  ce_virtual_signup_email_confirmation: VirtualSignupEmailConfirmation;
279
- ce_bot_dashboard_form: BotDashboardForm;
280
- ce_bot_quick_strategy_form: BotQuickStrategyForm;
281
- ce_bot_builder_form: BotBuilderForm;
282
- ce_bot_tutorial_form: BotTutorialForm;
256
+ ce_bot_form: BotForm;
283
257
  ce_contracts_set_up_form: ContractsSetupForm;
284
258
  ce_indicators_types_form: IndicatorsTypesFormAction;
285
259
  ce_trade_types_form: TradeTypesForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deriv-com/analytics",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "The analytics package contains all the utility functions used for tracking user events and sending them to the respective platform such as Rudderstack.",
5
5
  "keywords": [
6
6
  "rudderstack",