@developer_tribe/react-native-comnyx 0.4.0 → 0.4.1
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.
- package/lib/commonjs/Accumulator.js +28 -1
- package/lib/commonjs/Accumulator.js.map +1 -1
- package/lib/commonjs/components/ChatList.js +1 -1
- package/lib/module/Accumulator.js +28 -1
- package/lib/module/Accumulator.js.map +1 -1
- package/lib/module/components/ChatList.js +1 -1
- package/lib/typescript/commonjs/src/Accumulator.d.ts.map +1 -1
- package/lib/typescript/module/src/Accumulator.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Accumulator.ts +31 -4
- package/src/components/ChatList.tsx +1 -1
|
@@ -24,6 +24,25 @@ class Accumulator {
|
|
|
24
24
|
if (!this.registerData) {
|
|
25
25
|
throw new Error('Register data is not set');
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
// First, create a map of existing custom parameters by name
|
|
29
|
+
const customParamsMap = new Map();
|
|
30
|
+
|
|
31
|
+
// Add existing parameters to the map
|
|
32
|
+
(this.registerData.customParameters || []).forEach(param => {
|
|
33
|
+
customParamsMap.set(param.name, param.value);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Add or override with new parameters
|
|
37
|
+
(data.customParameters || []).forEach(param => {
|
|
38
|
+
customParamsMap.set(param.name, param.value);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Convert map back to array of CustomParameter objects
|
|
42
|
+
const mergedCustomParameters = Array.from(customParamsMap.entries()).map(([name, value]) => ({
|
|
43
|
+
name,
|
|
44
|
+
value
|
|
45
|
+
}));
|
|
27
46
|
this.registerData = {
|
|
28
47
|
...this.registerData,
|
|
29
48
|
...data,
|
|
@@ -31,7 +50,7 @@ class Accumulator {
|
|
|
31
50
|
...(this.registerData.integrationParameters || {}),
|
|
32
51
|
...(data.integrationParameters || {})
|
|
33
52
|
},
|
|
34
|
-
customParameters:
|
|
53
|
+
customParameters: mergedCustomParameters
|
|
35
54
|
};
|
|
36
55
|
this.debounce();
|
|
37
56
|
}
|
|
@@ -41,6 +60,10 @@ class Accumulator {
|
|
|
41
60
|
}
|
|
42
61
|
if (this.listener) {
|
|
43
62
|
await this.listener(this.registerData);
|
|
63
|
+
this.registerData = {
|
|
64
|
+
...this.registerData,
|
|
65
|
+
customParameters: []
|
|
66
|
+
};
|
|
44
67
|
this._isListenerCalledOnce = true;
|
|
45
68
|
}
|
|
46
69
|
this.reset();
|
|
@@ -53,6 +76,10 @@ class Accumulator {
|
|
|
53
76
|
this.__select_time = setTimeout(() => {
|
|
54
77
|
if (this.listener) {
|
|
55
78
|
this.listener(this.registerData);
|
|
79
|
+
this.registerData = {
|
|
80
|
+
...this.registerData,
|
|
81
|
+
customParameters: []
|
|
82
|
+
};
|
|
56
83
|
this._isListenerCalledOnce = true;
|
|
57
84
|
}
|
|
58
85
|
}, ACCUMULATOR_DEBOUNCE_TIME_IN_MS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","externalId","customParameters","integrationParameters","debounce","add","data","Error","flush","reset","setTimeout","clearTimeout","get","isListenerCalledOnce","accumulator","exports"],"sourceRoot":"../../src","sources":["Accumulator.ts"],"mappings":";;;;;;AAEA,MAAMA,+BAA+B,GAAG,IAAI;AAE5C,MAAMC,WAAW,CAAC;EACRC,YAAY,GAAiC,IAAI;EACjDC,aAAa,GAA+BC,SAAS;EACrDC,QAAQ,GACd,IAAI;EACEC,qBAAqB,GAAY,KAAK;EAC9CC,WAAWA,CAAA,EAAG,CAAC;EAEfC,QAAQA,CACNC,UAAkB,EAClBJ,QAAwD,EACxD;IACA,IAAI,CAACH,YAAY,GAAG;MAClBO,UAAU;MACVC,gBAAgB,EAAE,EAAE;MACpBC,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAACN,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACO,QAAQ,CAAC,CAAC;EACjB;EAEAC,GAAGA,CAACC,IAAwD,EAAE;IAC5D,IAAI,CAAC,IAAI,CAACZ,YAAY,EAAE;MACtB,MAAM,IAAIa,KAAK,CAAC,0BAA0B,CAAC;IAC7C;IACA,
|
|
1
|
+
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","externalId","customParameters","integrationParameters","debounce","add","data","Error","customParamsMap","Map","forEach","param","set","name","value","mergedCustomParameters","Array","from","entries","map","flush","reset","setTimeout","clearTimeout","get","isListenerCalledOnce","accumulator","exports"],"sourceRoot":"../../src","sources":["Accumulator.ts"],"mappings":";;;;;;AAEA,MAAMA,+BAA+B,GAAG,IAAI;AAE5C,MAAMC,WAAW,CAAC;EACRC,YAAY,GAAiC,IAAI;EACjDC,aAAa,GAA+BC,SAAS;EACrDC,QAAQ,GACd,IAAI;EACEC,qBAAqB,GAAY,KAAK;EAC9CC,WAAWA,CAAA,EAAG,CAAC;EAEfC,QAAQA,CACNC,UAAkB,EAClBJ,QAAwD,EACxD;IACA,IAAI,CAACH,YAAY,GAAG;MAClBO,UAAU;MACVC,gBAAgB,EAAE,EAAE;MACpBC,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAACN,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACO,QAAQ,CAAC,CAAC;EACjB;EAEAC,GAAGA,CAACC,IAAwD,EAAE;IAC5D,IAAI,CAAC,IAAI,CAACZ,YAAY,EAAE;MACtB,MAAM,IAAIa,KAAK,CAAC,0BAA0B,CAAC;IAC7C;;IAEA;IACA,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAiB,CAAC;;IAEjD;IACA,CAAC,IAAI,CAACf,YAAY,CAACQ,gBAAgB,IAAI,EAAE,EAAEQ,OAAO,CAAEC,KAAK,IAAK;MAC5DH,eAAe,CAACI,GAAG,CAACD,KAAK,C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ACtB,MAAM,IAAIa,KAAK,CAAC,0BAA0B,CAAC;IAC7C;IACA,IAAI,CAACc,KAAK,CAAC,CAAC;IACZ,IAAI,CAAC1B,aAAa,GAAG2B,UAAU,CAAC,MAAM;MACpC,IAAI,IAAI,CAACzB,QAAQ,EAAE;QACjB,IAAI,CAACA,QAAQ,CAAC,IAAI,CAACH,YAAa,CAAC;QACjC,IAAI,CAACA,YAAY,GAAG;UAClB,GAAG,IAAI,CAACA,YAAa;UACrBQ,gBAAgB,EAAE;QACpB,CAAC;QACD,IAAI,CAACJ,qBAAqB,GAAG,IAAI;MACnC;IACF,CAAC,EAAEN,+BAA+B,CAAC;EACrC;EAEA6B,KAAKA,CAAA,EAAG;IACN,IAAI,IAAI,CAAC1B,aAAa,EAAE;MACtB4B,YAAY,CAAC,IAAI,CAAC5B,aAAa,CAAC;IAClC;EACF;EAEA6B,GAAGA,CAAA,EAAG;IACJ,OAAO,IAAI,CAAC9B,YAAY;EAC1B;EAEA+B,oBAAoBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAAC3B,qBAAqB;EACnC;AACF;AAEO,MAAM4B,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAIjC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -20,6 +20,25 @@ class Accumulator {
|
|
|
20
20
|
if (!this.registerData) {
|
|
21
21
|
throw new Error('Register data is not set');
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
// First, create a map of existing custom parameters by name
|
|
25
|
+
const customParamsMap = new Map();
|
|
26
|
+
|
|
27
|
+
// Add existing parameters to the map
|
|
28
|
+
(this.registerData.customParameters || []).forEach(param => {
|
|
29
|
+
customParamsMap.set(param.name, param.value);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Add or override with new parameters
|
|
33
|
+
(data.customParameters || []).forEach(param => {
|
|
34
|
+
customParamsMap.set(param.name, param.value);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Convert map back to array of CustomParameter objects
|
|
38
|
+
const mergedCustomParameters = Array.from(customParamsMap.entries()).map(([name, value]) => ({
|
|
39
|
+
name,
|
|
40
|
+
value
|
|
41
|
+
}));
|
|
23
42
|
this.registerData = {
|
|
24
43
|
...this.registerData,
|
|
25
44
|
...data,
|
|
@@ -27,7 +46,7 @@ class Accumulator {
|
|
|
27
46
|
...(this.registerData.integrationParameters || {}),
|
|
28
47
|
...(data.integrationParameters || {})
|
|
29
48
|
},
|
|
30
|
-
customParameters:
|
|
49
|
+
customParameters: mergedCustomParameters
|
|
31
50
|
};
|
|
32
51
|
this.debounce();
|
|
33
52
|
}
|
|
@@ -37,6 +56,10 @@ class Accumulator {
|
|
|
37
56
|
}
|
|
38
57
|
if (this.listener) {
|
|
39
58
|
await this.listener(this.registerData);
|
|
59
|
+
this.registerData = {
|
|
60
|
+
...this.registerData,
|
|
61
|
+
customParameters: []
|
|
62
|
+
};
|
|
40
63
|
this._isListenerCalledOnce = true;
|
|
41
64
|
}
|
|
42
65
|
this.reset();
|
|
@@ -49,6 +72,10 @@ class Accumulator {
|
|
|
49
72
|
this.__select_time = setTimeout(() => {
|
|
50
73
|
if (this.listener) {
|
|
51
74
|
this.listener(this.registerData);
|
|
75
|
+
this.registerData = {
|
|
76
|
+
...this.registerData,
|
|
77
|
+
customParameters: []
|
|
78
|
+
};
|
|
52
79
|
this._isListenerCalledOnce = true;
|
|
53
80
|
}
|
|
54
81
|
}, ACCUMULATOR_DEBOUNCE_TIME_IN_MS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","externalId","customParameters","integrationParameters","debounce","add","data","Error","flush","reset","setTimeout","clearTimeout","get","isListenerCalledOnce","accumulator"],"sourceRoot":"../../src","sources":["Accumulator.ts"],"mappings":";;AAEA,MAAMA,+BAA+B,GAAG,IAAI;AAE5C,MAAMC,WAAW,CAAC;EACRC,YAAY,GAAiC,IAAI;EACjDC,aAAa,GAA+BC,SAAS;EACrDC,QAAQ,GACd,IAAI;EACEC,qBAAqB,GAAY,KAAK;EAC9CC,WAAWA,CAAA,EAAG,CAAC;EAEfC,QAAQA,CACNC,UAAkB,EAClBJ,QAAwD,EACxD;IACA,IAAI,CAACH,YAAY,GAAG;MAClBO,UAAU;MACVC,gBAAgB,EAAE,EAAE;MACpBC,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAACN,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACO,QAAQ,CAAC,CAAC;EACjB;EAEAC,GAAGA,CAACC,IAAwD,EAAE;IAC5D,IAAI,CAAC,IAAI,CAACZ,YAAY,EAAE;MACtB,MAAM,IAAIa,KAAK,CAAC,0BAA0B,CAAC;IAC7C;IACA,
|
|
1
|
+
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","externalId","customParameters","integrationParameters","debounce","add","data","Error","customParamsMap","Map","forEach","param","set","name","value","mergedCustomParameters","Array","from","entries","map","flush","reset","setTimeout","clearTimeout","get","isListenerCalledOnce","accumulator"],"sourceRoot":"../../src","sources":["Accumulator.ts"],"mappings":";;AAEA,MAAMA,+BAA+B,GAAG,IAAI;AAE5C,MAAMC,WAAW,CAAC;EACRC,YAAY,GAAiC,IAAI;EACjDC,aAAa,GAA+BC,SAAS;EACrDC,QAAQ,GACd,IAAI;EACEC,qBAAqB,GAAY,KAAK;EAC9CC,WAAWA,CAAA,EAAG,CAAC;EAEfC,QAAQA,CACNC,UAAkB,EAClBJ,QAAwD,EACxD;IACA,IAAI,CAACH,YAAY,GAAG;MAClBO,UAAU;MACVC,gBAAgB,EAAE,EAAE;MACpBC,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAACN,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACO,QAAQ,CAAC,CAAC;EACjB;EAEAC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Q,EAAE;MACjB,MAAM,IAAI,CAACA,QAAQ,CAAC,IAAI,CAACH,YAAa,CAAC;MACvC,IAAI,CAACA,YAAY,GAAG;QAClB,GAAG,IAAI,CAACA,YAAY;QACpBQ,gBAAgB,EAAE;MACpB,CAAC;MACD,IAAI,CAACJ,qBAAqB,GAAG,IAAI;IACnC;IACA,IAAI,CAACuB,KAAK,CAAC,CAAC;EACd;EAEAjB,QAAQA,CAAA,EAAG;IACT,IAAI,CAAC,IAAI,CAACV,YAAY,EAAE;MACtB,MAAM,IAAIa,KAAK,CAAC,0BAA0B,CAAC;IAC7C;IACA,IAAI,CAACc,KAAK,CAAC,CAAC;IACZ,IAAI,CAAC1B,aAAa,GAAG2B,UAAU,CAAC,MAAM;MACpC,IAAI,IAAI,CAACzB,QAAQ,EAAE;QACjB,IAAI,CAACA,QAAQ,CAAC,IAAI,CAACH,YAAa,CAAC;QACjC,IAAI,CAACA,YAAY,GAAG;UAClB,GAAG,IAAI,CAACA,YAAa;UACrBQ,gBAAgB,EAAE;QACpB,CAAC;QACD,IAAI,CAACJ,qBAAqB,GAAG,IAAI;MACnC;IACF,CAAC,EAAEN,+BAA+B,CAAC;EACrC;EAEA6B,KAAKA,CAAA,EAAG;IACN,IAAI,IAAI,CAAC1B,aAAa,EAAE;MACtB4B,YAAY,CAAC,IAAI,CAAC5B,aAAa,CAAC;IAClC;EACF;EAEA6B,GAAGA,CAAA,EAAG;IACJ,OAAO,IAAI,CAAC9B,YAAY;EAC1B;EAEA+B,oBAAoBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAAC3B,qBAAqB;EACnC;AACF;AAEA,OAAO,MAAM4B,WAAW,GAAG,IAAIjC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../../../../src/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAI9D,cAAM,WAAW;IACf,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CACT;IACP,OAAO,CAAC,qBAAqB,CAAkB;;IAG/C,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC;IAW1D,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../../../../src/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAI9D,cAAM,WAAW;IACf,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CACT;IACP,OAAO,CAAC,qBAAqB,CAAkB;;IAG/C,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC;IAW1D,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;IAsCtD,KAAK;IAeX,QAAQ;IAiBR,KAAK;IAML,GAAG;IAIH,oBAAoB;CAGrB;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../../../../src/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAI9D,cAAM,WAAW;IACf,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CACT;IACP,OAAO,CAAC,qBAAqB,CAAkB;;IAG/C,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC;IAW1D,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../../../../src/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAI9D,cAAM,WAAW;IACf,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CACT;IACP,OAAO,CAAC,qBAAqB,CAAkB;;IAG/C,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC;IAW1D,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;IAsCtD,KAAK;IAeX,QAAQ;IAiBR,KAAK;IAML,GAAG;IAIH,oBAAoB;CAGrB;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developer_tribe/react-native-comnyx",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
package/src/Accumulator.ts
CHANGED
|
@@ -27,6 +27,28 @@ class Accumulator {
|
|
|
27
27
|
if (!this.registerData) {
|
|
28
28
|
throw new Error('Register data is not set');
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
// First, create a map of existing custom parameters by name
|
|
32
|
+
const customParamsMap = new Map<string, string>();
|
|
33
|
+
|
|
34
|
+
// Add existing parameters to the map
|
|
35
|
+
(this.registerData.customParameters || []).forEach((param) => {
|
|
36
|
+
customParamsMap.set(param.name, param.value);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Add or override with new parameters
|
|
40
|
+
(data.customParameters || []).forEach((param) => {
|
|
41
|
+
customParamsMap.set(param.name, param.value);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Convert map back to array of CustomParameter objects
|
|
45
|
+
const mergedCustomParameters = Array.from(customParamsMap.entries()).map(
|
|
46
|
+
([name, value]) => ({
|
|
47
|
+
name,
|
|
48
|
+
value,
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
|
|
30
52
|
this.registerData = {
|
|
31
53
|
...this.registerData,
|
|
32
54
|
...data,
|
|
@@ -34,10 +56,7 @@ class Accumulator {
|
|
|
34
56
|
...(this.registerData.integrationParameters || {}),
|
|
35
57
|
...(data.integrationParameters || {}),
|
|
36
58
|
},
|
|
37
|
-
customParameters:
|
|
38
|
-
...(this.registerData.customParameters || []),
|
|
39
|
-
...(data.customParameters || []),
|
|
40
|
-
],
|
|
59
|
+
customParameters: mergedCustomParameters,
|
|
41
60
|
};
|
|
42
61
|
this.debounce();
|
|
43
62
|
}
|
|
@@ -48,6 +67,10 @@ class Accumulator {
|
|
|
48
67
|
}
|
|
49
68
|
if (this.listener) {
|
|
50
69
|
await this.listener(this.registerData!);
|
|
70
|
+
this.registerData = {
|
|
71
|
+
...this.registerData,
|
|
72
|
+
customParameters: [],
|
|
73
|
+
};
|
|
51
74
|
this._isListenerCalledOnce = true;
|
|
52
75
|
}
|
|
53
76
|
this.reset();
|
|
@@ -61,6 +84,10 @@ class Accumulator {
|
|
|
61
84
|
this.__select_time = setTimeout(() => {
|
|
62
85
|
if (this.listener) {
|
|
63
86
|
this.listener(this.registerData!);
|
|
87
|
+
this.registerData = {
|
|
88
|
+
...this.registerData!,
|
|
89
|
+
customParameters: [],
|
|
90
|
+
};
|
|
64
91
|
this._isListenerCalledOnce = true;
|
|
65
92
|
}
|
|
66
93
|
}, ACCUMULATOR_DEBOUNCE_TIME_IN_MS);
|