@subiz/widget-v4 4.0.71 → 4.0.72

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.
@@ -4181,14 +4181,6 @@ cookie.defaults.path = '/';
4181
4181
  cookie.expiresMultiplier = 60 * 60 * 24;
4182
4182
  cookie.defaults.expires = 3650;
4183
4183
  const MAX_CONVO = 20;
4184
- let ga_client_id = '';
4185
- setTimeout(() => {
4186
- if (window.gtag) {
4187
- window.gtag('get', 'UA-XXXXXXXX-Y', 'client_id', clientid => {
4188
- ga_client_id = clientid;
4189
- });
4190
- }
4191
- }, 100);
4192
4184
  const page_loaded = util/* default.Date.now */.Z.Date.now();
4193
4185
  class Store {
4194
4186
  constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi, agenttoken) {
@@ -5276,22 +5268,21 @@ const inmemCookie = {
5276
5268
  };
5277
5269
 
5278
5270
  function getGaClientId() {
5279
- if (ga_client_id) return ga_client_id;
5280
- if (!hasGA()) return ga_client_id;
5281
5271
  if (!window.ga) return;
5272
+ if (!window.ga.getAll) return;
5282
5273
  var allTrackers = window.ga.getAll() || [];
5274
+ let ga_client_id = '';
5283
5275
  allTrackers.forEach(function (tracker) {
5284
5276
  ga_client_id = tracker.get('clientId');
5285
5277
  });
5286
5278
  return ga_client_id;
5287
5279
  }
5288
5280
 
5289
- const hasGA = () => !!(window.ga && window.ga.getAll || window.gtag);
5290
-
5291
5281
  function getGaTrackingIds() {
5292
5282
  var trackingIds = [];
5293
- if (!hasGA()) return trackingIds;
5283
+ if (!(window.ga && window.ga.getAll)) return trackingIds;
5294
5284
  if (!window.ga) return [];
5285
+ if (!window.ga.getAll) return [];
5295
5286
  const allTrackers = window.ga.getAll() || [];
5296
5287
  allTrackers.forEach(function (tracker) {
5297
5288
  var trackingId = tracker.get('trackingId');
@@ -5309,18 +5300,19 @@ function sendToFBPixel(category, action, label) {
5309
5300
  }
5310
5301
 
5311
5302
  function sendToGA(category, action, label) {
5312
- if (!hasGA()) return;
5313
- if (window.gtag) window.gtag('event', category, {
5314
- Action: action,
5315
- Label: label
5316
- });
5303
+ console.log('SENT.', category, action, label);
5317
5304
 
5318
- if (window.ga) {
5305
+ if (window.ga && window.ga.getAll) {
5319
5306
  const allTrackers = window.ga.getAll() || [];
5320
5307
  allTrackers.forEach(function (tracker) {
5321
5308
  const name = tracker.get('name');
5322
5309
  window.ga(name + '.send', 'event', category, action, label);
5323
5310
  });
5311
+ } else {
5312
+ if (window.gtag) window.gtag('event', category, {
5313
+ Action: action,
5314
+ Label: label
5315
+ });
5324
5316
  }
5325
5317
  }
5326
5318
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.0.71",
3
+ "version": "4.0.72",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -23,14 +23,15 @@
23
23
  "preact": "^10.7.1"
24
24
  },
25
25
  "devDependencies": {
26
+ "@babel/cli": "^7.17.5",
26
27
  "@babel/core": "^7.17.9",
27
28
  "@babel/plugin-proposal-class-properties": "^7.16.7",
28
29
  "@babel/plugin-transform-react-jsx": "^7.17.3",
29
30
  "@babel/preset-env": "^7.16.11",
30
- "@babel/cli": "^7.17.5",
31
31
  "babel-loader": "^8.2.4",
32
32
  "babel-plugin-syntax-jsx": "^6.18.0",
33
33
  "html-webpack-plugin": "^5.5.0",
34
+ "prettier": "^2.6.2",
34
35
  "puppeteer": "^13.6.0",
35
36
  "webpack": "^5.72.0",
36
37
  "webpack-bundle-analyzer": "^4.5.0",
@@ -144,7 +144,7 @@ export default class Order extends common.Com {
144
144
  renderDesktopPaymentMethod(order) {
145
145
  return null
146
146
  let editmode = false
147
- if (!order.status || order.status == 'new') {
147
+ if (!order.status || order.status == 'open') {
148
148
  editmode = !order.user_confirmation
149
149
  }
150
150
 
@@ -246,7 +246,7 @@ export default class Order extends common.Com {
246
246
 
247
247
  renderDesktopShipping(order) {
248
248
  let editmode = false
249
- if (!order.status || order.status == 'new') {
249
+ if (!order.status || order.status == 'open') {
250
250
  editmode = !order.user_confirmation
251
251
  }
252
252
 
@@ -566,7 +566,7 @@ export default class Order extends common.Com {
566
566
  )
567
567
 
568
568
  let editmode = false
569
- if (!order.status || order.status == 'new') {
569
+ if (!order.status || order.status == 'open') {
570
570
  editmode = !order.user_confirmation
571
571
  }
572
572
  let $note = null
@@ -611,7 +611,7 @@ export default class Order extends common.Com {
611
611
  }
612
612
 
613
613
  renderStatusBadge(order) {
614
- let status = order.status || 'new'
614
+ let status = order.status || 'open'
615
615
  return (
616
616
  <div style='float: right !important;' class={'order_status order_status__' + status}>
617
617
  {status}
@@ -620,7 +620,7 @@ export default class Order extends common.Com {
620
620
  }
621
621
 
622
622
  renderShippingInfo(order) {
623
- if (order.status != 'new' || order.user_confirmation) {
623
+ if (order.status != 'open' || order.user_confirmation) {
624
624
  // read only
625
625
  }
626
626
 
@@ -752,7 +752,7 @@ export default class Order extends common.Com {
752
752
  renderDesktopProducts(order) {
753
753
  let $products = null
754
754
  let editmode = false
755
- if (!order.status || order.status == 'new') {
755
+ if (!order.status || order.status == 'open') {
756
756
  editmode = !order.user_confirmation
757
757
  }
758
758
 
@@ -868,10 +868,10 @@ export default class Order extends common.Com {
868
868
  </div>
869
869
  )
870
870
 
871
-
872
-
873
871
 
874
- if (order.user_confirmation || order.status != 'new') {
872
+
873
+
874
+ if (order.user_confirmation || order.status != 'open') {
875
875
  $status = null
876
876
  if (this.props.cid)
877
877
  $close = (
@@ -881,7 +881,7 @@ export default class Order extends common.Com {
881
881
  )
882
882
  }
883
883
 
884
-
884
+
885
885
 
886
886
  return (
887
887
  <div class='order' style='height: 100% !important'>
@@ -912,7 +912,7 @@ export default class Order extends common.Com {
912
912
  renderActions(order) {
913
913
  let $actions = null
914
914
  let editmode = false
915
- if (!order.status || order.status == 'new') {
915
+ if (!order.status || order.status == 'open') {
916
916
  editmode = !order.user_confirmation
917
917
  }
918
918
 
@@ -11,16 +11,6 @@ cookie.expiresMultiplier = 60 * 60 * 24 // days
11
11
  cookie.defaults.expires = 3650 // 10 year
12
12
 
13
13
  const MAX_CONVO = 20
14
- let ga_client_id = ''
15
-
16
- setTimeout(() => {
17
- if (window.gtag) {
18
- window.gtag('get', 'UA-XXXXXXXX-Y', 'client_id', (clientid) => {
19
- ga_client_id = clientid
20
- })
21
- }
22
- }, 100)
23
-
24
14
  const page_loaded = sb.Date.now()
25
15
 
26
16
  // available localstorage key mask, user, session, hasManuallyClosed, isopen, close_preview_at, lastview, bot_run_logs, plugin_run_logs
@@ -1100,11 +1090,10 @@ const inmemCookie = {
1100
1090
  // getGaClientId returns ID of the client in Google Analytics
1101
1091
  // return empty string if GA is not installed
1102
1092
  function getGaClientId() {
1103
- if (ga_client_id) return ga_client_id
1104
- if (!hasGA()) return ga_client_id
1105
-
1106
1093
  if (!window.ga) return
1094
+ if (!window.ga.getAll) return
1107
1095
  var allTrackers = window.ga.getAll() || []
1096
+ let ga_client_id = ''
1108
1097
  allTrackers.forEach(function (tracker) {
1109
1098
  ga_client_id = tracker.get('clientId')
1110
1099
  })
@@ -1112,16 +1101,14 @@ function getGaClientId() {
1112
1101
  return ga_client_id
1113
1102
  }
1114
1103
 
1115
- // hasGA tells if the website is using Google Analytics or not
1116
- const hasGA = () => !!((window.ga && window.ga.getAll) || window.gtag)
1117
-
1118
1104
  // getGaTrackingIds returns all tracking ids in Google Analytics
1119
1105
  // return empty array if GA is not installed
1120
1106
  function getGaTrackingIds() {
1121
1107
  var trackingIds = []
1122
- if (!hasGA()) return trackingIds
1108
+ if (!(window.ga && window.ga.getAll)) return trackingIds
1123
1109
 
1124
1110
  if (!window.ga) return []
1111
+ if (!window.ga.getAll) return []
1125
1112
  const allTrackers = window.ga.getAll() || []
1126
1113
  allTrackers.forEach(function (tracker) {
1127
1114
  var trackingId = tracker.get('trackingId')
@@ -1138,16 +1125,16 @@ function sendToFBPixel(category, action, label) {
1138
1125
  }
1139
1126
 
1140
1127
  function sendToGA(category, action, label) {
1141
- if (!hasGA()) return
1142
-
1143
- if (window.gtag) window.gtag('event', category, {Action: action, Label: label})
1144
-
1145
- if (window.ga) {
1128
+ console.log('SENT.', category, action, label)
1129
+ if (window.ga && window.ga.getAll) {
1146
1130
  const allTrackers = window.ga.getAll() || []
1147
1131
  allTrackers.forEach(function (tracker) {
1148
1132
  const name = tracker.get('name')
1149
1133
  window.ga(name + '.send', 'event', category, action, label)
1150
1134
  })
1135
+ } else {
1136
+ // only send gtag when ga is not available
1137
+ if (window.gtag) window.gtag('event', category, {Action: action, Label: label})
1151
1138
  }
1152
1139
  }
1153
1140