@developer_tribe/react-native-comnyx 0.3.14 → 0.4.0

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 (87) hide show
  1. package/lib/commonjs/Accumulator.js +73 -0
  2. package/lib/commonjs/Accumulator.js.map +1 -0
  3. package/lib/commonjs/App.js +6 -6
  4. package/lib/commonjs/App.js.map +1 -1
  5. package/lib/commonjs/api/customers.js +1 -0
  6. package/lib/commonjs/api/customers.js.map +1 -1
  7. package/lib/commonjs/collectData.js +27 -0
  8. package/lib/commonjs/collectData.js.map +1 -0
  9. package/lib/commonjs/components/ChatList.js +5 -3
  10. package/lib/commonjs/components/ChatList.js.map +1 -1
  11. package/lib/commonjs/components/CustomerForm.js +29 -3
  12. package/lib/commonjs/components/CustomerForm.js.map +1 -1
  13. package/lib/commonjs/components/EmptyList.js +4 -1
  14. package/lib/commonjs/components/EmptyList.js.map +1 -1
  15. package/lib/commonjs/data/fake/customers.js +0 -1
  16. package/lib/commonjs/data/fake/customers.js.map +1 -1
  17. package/lib/commonjs/index.js +13 -0
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/register.js +8 -0
  20. package/lib/commonjs/register.js.map +1 -1
  21. package/lib/commonjs/store.js +14 -5
  22. package/lib/commonjs/store.js.map +1 -1
  23. package/lib/module/Accumulator.js +69 -0
  24. package/lib/module/Accumulator.js.map +1 -0
  25. package/lib/module/App.js +6 -6
  26. package/lib/module/App.js.map +1 -1
  27. package/lib/module/api/customers.js +1 -0
  28. package/lib/module/api/customers.js.map +1 -1
  29. package/lib/module/collectData.js +22 -0
  30. package/lib/module/collectData.js.map +1 -0
  31. package/lib/module/components/ChatList.js +5 -3
  32. package/lib/module/components/ChatList.js.map +1 -1
  33. package/lib/module/components/CustomerForm.js +31 -5
  34. package/lib/module/components/CustomerForm.js.map +1 -1
  35. package/lib/module/components/EmptyList.js +4 -1
  36. package/lib/module/components/EmptyList.js.map +1 -1
  37. package/lib/module/data/fake/customers.js +0 -1
  38. package/lib/module/data/fake/customers.js.map +1 -1
  39. package/lib/module/index.js +1 -0
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/register.js +8 -0
  42. package/lib/module/register.js.map +1 -1
  43. package/lib/module/store.js +14 -5
  44. package/lib/module/store.js.map +1 -1
  45. package/lib/typescript/commonjs/src/Accumulator.d.ts +18 -0
  46. package/lib/typescript/commonjs/src/Accumulator.d.ts.map +1 -0
  47. package/lib/typescript/commonjs/src/api/customers.d.ts.map +1 -1
  48. package/lib/typescript/commonjs/src/collectData.d.ts +3 -0
  49. package/lib/typescript/commonjs/src/collectData.d.ts.map +1 -0
  50. package/lib/typescript/commonjs/src/components/ChatList.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts.map +1 -1
  52. package/lib/typescript/commonjs/src/data/fake/customers.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  54. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/src/register.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/src/store.d.ts +3 -1
  57. package/lib/typescript/commonjs/src/store.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/src/types/Customer.d.ts +17 -7
  59. package/lib/typescript/commonjs/src/types/Customer.d.ts.map +1 -1
  60. package/lib/typescript/module/src/Accumulator.d.ts +18 -0
  61. package/lib/typescript/module/src/Accumulator.d.ts.map +1 -0
  62. package/lib/typescript/module/src/api/customers.d.ts.map +1 -1
  63. package/lib/typescript/module/src/collectData.d.ts +3 -0
  64. package/lib/typescript/module/src/collectData.d.ts.map +1 -0
  65. package/lib/typescript/module/src/components/ChatList.d.ts.map +1 -1
  66. package/lib/typescript/module/src/components/CustomerForm.d.ts.map +1 -1
  67. package/lib/typescript/module/src/data/fake/customers.d.ts.map +1 -1
  68. package/lib/typescript/module/src/index.d.ts +1 -0
  69. package/lib/typescript/module/src/index.d.ts.map +1 -1
  70. package/lib/typescript/module/src/register.d.ts.map +1 -1
  71. package/lib/typescript/module/src/store.d.ts +3 -1
  72. package/lib/typescript/module/src/store.d.ts.map +1 -1
  73. package/lib/typescript/module/src/types/Customer.d.ts +17 -7
  74. package/lib/typescript/module/src/types/Customer.d.ts.map +1 -1
  75. package/package.json +1 -1
  76. package/src/Accumulator.ts +84 -0
  77. package/src/App.tsx +5 -5
  78. package/src/api/customers.ts +1 -0
  79. package/src/collectData.ts +26 -0
  80. package/src/components/ChatList.tsx +4 -2
  81. package/src/components/CustomerForm.tsx +34 -4
  82. package/src/components/EmptyList.tsx +1 -0
  83. package/src/data/fake/customers.ts +6 -7
  84. package/src/index.tsx +4 -0
  85. package/src/register.ts +12 -0
  86. package/src/store.ts +13 -5
  87. package/src/types/Customer.ts +19 -7
@@ -1 +1 @@
1
- {"version":3,"names":["initApi","useAppStore","registerComnyx","registerOptions","externalId","Error","token","getState","init"],"sourceRoot":"../../src","sources":["register.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,cAAW;AACnC,SAASC,WAAW,QAAQ,YAAS;AAErC,OAAO,SAASC,cAAcA,CAACC,eAG9B,EAAE;EACD,IAAI,CAACA,eAAe,CAACC,UAAU,EAAE;IAC/B,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EACA,IAAI,CAACF,eAAe,CAACG,KAAK,EAAE;IAC1B,MAAM,IAAID,KAAK,CAAC,kCAAkC,CAAC;EACrD;EAEAL,OAAO,CAACG,eAAe,CAACG,KAAK,CAAC;EAC9BL,WAAW,CAACM,QAAQ,CAAC,CAAC,CAACC,IAAI,CAAC;IAAEJ,UAAU,EAAED,eAAe,CAACC;EAAW,CAAC,CAAC;AACzE","ignoreList":[]}
1
+ {"version":3,"names":["accumulator","initApi","useAppStore","createCustomer","registerComnyx","registerOptions","externalId","Error","token","getState","init","register","accumulatedData","customer","fake","setCustomer"],"sourceRoot":"../../src","sources":["register.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAC3C,SAASC,OAAO,QAAQ,cAAW;AACnC,SAASC,WAAW,QAAQ,YAAS;AACrC,SAASC,cAAc,QAAQ,oBAAiB;AAGhD,OAAO,SAASC,cAAcA,CAACC,eAG9B,EAAE;EACD,IAAI,CAACA,eAAe,CAACC,UAAU,EAAE;IAC/B,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EACA,IAAI,CAACF,eAAe,CAACG,KAAK,EAAE;IAC1B,MAAM,IAAID,KAAK,CAAC,kCAAkC,CAAC;EACrD;EAEAN,OAAO,CAACI,eAAe,CAACG,KAAK,CAAC;EAC9BN,WAAW,CAACO,QAAQ,CAAC,CAAC,CAACC,IAAI,CAAC;IAAEJ,UAAU,EAAED,eAAe,CAACC;EAAW,CAAC,CAAC;EACvEN,WAAW,CAACW,QAAQ,CAClBN,eAAe,CAACC,UAAU,EAC1B,MAAOM,eAAsC,IAAK;IAChD,MAAMC,QAAQ,GAAG,MAAMV,cAAc,CAACS,eAAe,EAAE;MACrDE,IAAI,EAAE;IACR,CAAC,CAAC;IACFZ,WAAW,CAACO,QAAQ,CAAC,CAAC,CAACM,WAAW,CAACF,QAAQ,CAAC;EAC9C,CACF,CAAC;AACH","ignoreList":[]}
@@ -16,6 +16,7 @@ const storeCreator = (set, get) => ({
16
16
  fake: false,
17
17
  themes: {},
18
18
  firstMessage: null,
19
+ formSubmitted: false,
19
20
  setData: cb => {
20
21
  const newData = cb(get().data);
21
22
  set({
@@ -31,13 +32,13 @@ const storeCreator = (set, get) => ({
31
32
  externalId
32
33
  }) => {
33
34
  set({
34
- externalId: externalId,
35
- initialized: true
35
+ externalId: externalId
36
36
  });
37
37
  },
38
- initForm: createCustomerResponse => {
38
+ setCustomer: createCustomerResponse => {
39
39
  set({
40
- customer: createCustomerResponse
40
+ customer: createCustomerResponse,
41
+ initialized: true
41
42
  });
42
43
  },
43
44
  setLanguage: language => {
@@ -68,15 +69,23 @@ const storeCreator = (set, get) => ({
68
69
  baseWidth,
69
70
  baseHeight
70
71
  });
72
+ },
73
+ setForm: form => {
74
+ set({
75
+ formSubmitted: true,
76
+ customer: form
77
+ });
71
78
  }
72
79
  });
73
80
  export const useAppStore = createWithEqualityFn()(persist(storeCreator, {
74
- name: 'commonyx_appStore-10',
81
+ name: 'commonyx_appStore-12',
75
82
  storage: createJSONStorage(() => AsyncStorage),
76
83
  skipHydration: false,
77
84
  partialize: state => ({
78
85
  customer: state.customer,
79
86
  externalId: state.externalId,
87
+ initialized: state.initialized,
88
+ formSubmitted: state.formSubmitted,
80
89
  data: state.data?.filter(message => message.approved).map(message => ({
81
90
  ...message,
82
91
  created_at: message.created_at ? new Date(message.created_at) : message.created_at
@@ -1 +1 @@
1
- {"version":3,"names":["createJSONStorage","persist","shallow","createWithEqualityFn","AsyncStorage","storeCreator","set","get","baseWidth","baseHeight","initialized","customer","data","externalId","language","theme","fake","themes","firstMessage","setData","cb","newData","setFirstMessage","message","init","initForm","createCustomerResponse","setLanguage","setTheme","setFake","setThemes","updateBaseDimensions","useAppStore","name","storage","skipHydration","partialize","state","filter","approved","map","created_at","Date"],"sourceRoot":"../../src","sources":["store.ts"],"mappings":";;AAAA,SAASA,iBAAiB,EAAEC,OAAO,QAAQ,oBAAoB;AAC/D,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,oBAAoB,QAAQ,qBAAqB;AAE1D,OAAOC,YAAY,MAAM,2CAA2C;AAmCpE,MAAMC,YAAyC,GAAGA,CAACC,GAAG,EAAEC,GAAG,MAAM;EAC/DC,SAAS,EAAE,GAAG;EACdC,UAAU,EAAE,GAAG;EACfC,WAAW,EAAE,KAAK;EAClBC,QAAQ,EAAE,IAAI;EACdC,IAAI,EAAE,IAAI;EACVC,UAAU,EAAE,IAAI;EAChBC,QAAQ,EAAE,IAAI;EACdC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,KAAK;EACXC,MAAM,EAAE,CAAC,CAAC;EACVC,YAAY,EAAE,IAAI;EAClBC,OAAO,EAAGC,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AAU,EAAGC,KAAK,KAAM;IACtB1B,QAAQ,EAAE0B,KAAK,CAAC1B,QAAQ;IACxBE,UAAU,EAAEwB,KAAK,CAACxB,UAAU;IAC5BD,IAAI,EAAEyB,KAAK,CAACzB,IAAI,EACZ0B,MAAM,CAAEf,OAAO,IAAKA,OAAO,CAACgB,QAAQ,CAAC,CACtCC,GAAG,CAAEjB,OAAO,KAAM;MACjB,GAAGA,OAAO;MACVkB,UAAU,EAAElB,OAAO,CAACkB,UAAU,GAC1B,IAAIC,IAAI,CAACnB,OAAO,CAACkB,UAAU,CAAC,GAC5BlB,OAAO,CAACkB;IACd,CAAC,CAAC;EACN,CAAC;AACH,CAAC,CAAC,EACFvC,OACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createJSONStorage","persist","shallow","createWithEqualityFn","AsyncStorage","storeCreator","set","get","baseWidth","baseHeight","initialized","customer","data","externalId","language","theme","fake","themes","firstMessage","formSubmitted","setData","cb","newData","setFirstMessage","message","init","setCustomer","createCustomerResponse","setLanguage","setTheme","setFake","setThemes","updateBaseDimensions","setForm","form","useAppStore","name","storage","skipHydration","partialize","state","filter","approved","map","created_at","Date"],"sourceRoot":"../../src","sources":["store.ts"],"mappings":";;AAAA,SAASA,iBAAiB,EAAEC,OAAO,QAAQ,oBAAoB;AAC/D,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,oBAAoB,QAAQ,qBAAqB;AAE1D,OAAOC,YAAY,MAAM,2CAA2C;AAqCpE,MAAMC,YAAyC,GAAGA,CAACC,GAAG,EAAEC,GAAG,MAAM;EAC/DC,SAAS,EAAE,GAAG;EACdC,UAAU,EAAE,GAAG;EACfC,WAAW,EAAE,KAAK;EAClBC,QAAQ,EAAE,IAAI;EACdC,IAAI,EAAE,IAAI;EACVC,UAAU,EAAE,IAAI;EAChBC,QAAQ,EAAE,IAAI;EACdC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,KAAK;EACXC,MAAM,EAAE,CAAC,CAAC;EACVC,Y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,MAAMC,WAAW,GAAGhC,oBAAoB,CAAgB,CAAC,CAC9DF,OAAO,CAACI,YAAY,EAAE;EACpB+B,IAAI,EAAE,sBAAsB;EAC5BC,OAAO,EAAErC,iBAAiB,CAAC,MAAMI,YAAY,CAAC;EAC9CkC,aAAa,EAAE,KAAK;EACpBC,UAAU,EAAGC,KAAK,KAAM;IACtB7B,QAAQ,EAAE6B,KAAK,CAAC7B,QAAQ;IACxBE,UAAU,EAAE2B,KAAK,CAAC3B,UAAU;IAC5BH,WAAW,EAAE8B,KAAK,CAAC9B,WAAW;IAC9BS,aAAa,EAAEqB,KAAK,CAACrB,aAAa;IAClCP,IAAI,EAAE4B,KAAK,CAAC5B,IAAI,EACZ6B,MAAM,CAAEjB,OAAO,IAAKA,OAAO,CAACkB,QAAQ,CAAC,CACtCC,GAAG,CAAEnB,OAAO,KAAM;MACjB,GAAGA,OAAO;MACVoB,UAAU,EAAEpB,OAAO,CAACoB,UAAU,GAC1B,IAAIC,IAAI,CAACrB,OAAO,CAACoB,UAAU,CAAC,GAC5BpB,OAAO,CAACoB;IACd,CAAC,CAAC;EACN,CAAC;AACH,CAAC,CAAC,EACF1C,OACF,CAAC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import type { CreateCustomerRequest } from './types/Customer';
2
+ declare class Accumulator {
3
+ private registerData;
4
+ private __select_time;
5
+ private listener;
6
+ private _isListenerCalledOnce;
7
+ constructor();
8
+ register(externalId: string, listener: (data: CreateCustomerRequest) => Promise<void>): void;
9
+ add(data: Partial<Omit<CreateCustomerRequest, 'externalId'>>): void;
10
+ flush(): Promise<void>;
11
+ debounce(): void;
12
+ reset(): void;
13
+ get(): CreateCustomerRequest | null;
14
+ isListenerCalledOnce(): boolean;
15
+ }
16
+ export declare const accumulator: Accumulator;
17
+ export {};
18
+ //# sourceMappingURL=Accumulator.d.ts.map
@@ -0,0 +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;IAmBtD,KAAK;IAWX,QAAQ;IAaR,KAAK;IAML,GAAG;IAIH,oBAAoB;CAGrB;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../src/api/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,qBAAqB,EACnC,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAOnB"}
1
+ {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../src/api/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,qBAAqB,EACnC,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAQnB"}
@@ -0,0 +1,3 @@
1
+ export declare function collectData(key: string, value: string): void;
2
+ export declare function registerOneSignalForComnyx(onesignal_id: string, external_id: string): void;
3
+ //# sourceMappingURL=collectData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectData.d.ts","sourceRoot":"","sources":["../../../../src/collectData.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QASrD;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,QAUpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatList.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,2CAwnB3D"}
1
+ {"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatList.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,2CAynB3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomerForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/CustomerForm.tsx"],"names":[],"mappings":"AAoCA,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,2CAuR9D"}
1
+ {"version":3,"file":"CustomerForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/CustomerForm.tsx"],"names":[],"mappings":"AAsCA,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,2CA8S9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../../src/data/fake/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5E,wBAAgB,eAAe,CAAC,YAAY,EAAE,qBAAqB,GAAG,QAAQ,CAgB7E"}
1
+ {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../../src/data/fake/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5E,wBAAgB,eAAe,CAAC,YAAY,EAAE,qBAAqB,GAAG,QAAQ,CAe7E"}
@@ -1,4 +1,5 @@
1
1
  import './__dev__';
2
+ export { collectData as collectDataForComnyx, registerOneSignalForComnyx, } from './collectData';
2
3
  export { registerComnyx } from './register';
3
4
  export type { CreateCustomerRequest } from './types/Customer';
4
5
  export { Comnyx } from './App';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AACnB,OAAO,EACL,WAAW,IAAI,oBAAoB,EACnC,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/register.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,eAAe,EAAE;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,QAUA"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/register.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,CAAC,eAAe,EAAE;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,QAmBA"}
@@ -18,7 +18,7 @@ interface AppStoreState {
18
18
  init: ({ externalId }: {
19
19
  externalId: string;
20
20
  }) => void;
21
- initForm: (createCustomerResponse: Customer) => void;
21
+ setCustomer: (createCustomerResponse: Customer) => void;
22
22
  setLanguage: (language: LanguageCode) => void;
23
23
  setTheme: (theme: 'light' | 'dark') => void;
24
24
  setFake: (fake: boolean) => void;
@@ -27,6 +27,8 @@ interface AppStoreState {
27
27
  baseHeight: number;
28
28
  baseWidth: number;
29
29
  }) => void;
30
+ formSubmitted: boolean;
31
+ setForm: (form: Customer) => void;
30
32
  }
31
33
  export declare const useAppStore: import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<import("zustand").StoreApi<AppStoreState>, "persist"> & {
32
34
  persist: {
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,sBAAsB,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AAI,CAAC;IACX,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACnC;AAgDD,eAAO,MAAM,WAAW;;;;;;;;;;EAqBvB,CAAC"}
@@ -2,21 +2,30 @@ export interface CustomParameter {
2
2
  name: string;
3
3
  value: string;
4
4
  }
5
+ export interface OneSignalIntegrationParameters {
6
+ onesignal_id: string;
7
+ external_id: string;
8
+ }
9
+ export interface IntegrationParameters {
10
+ onesignal?: OneSignalIntegrationParameters;
11
+ }
5
12
  export interface CreateCustomerRequest {
6
- name: string;
7
- country: string;
8
- language: string;
9
13
  externalId: string;
10
- email: string;
11
- phone: string;
12
- ipAddress: string;
14
+ name?: string;
15
+ country?: string;
16
+ language?: string;
17
+ email?: string;
18
+ phone?: string;
19
+ ipAddress?: string;
13
20
  customParameters?: CustomParameter[];
21
+ integrationParameters?: IntegrationParameters;
14
22
  }
15
23
  export interface Customer {
16
24
  id: number;
17
25
  project_id: number;
18
26
  external_id: string;
19
27
  name: string;
28
+ device: null | string;
20
29
  country: string;
21
30
  language: string;
22
31
  email: string;
@@ -24,7 +33,8 @@ export interface Customer {
24
33
  ip_address: string;
25
34
  custom_parameters: string;
26
35
  user_code: string;
27
- updated_at: string;
28
36
  created_at: string;
37
+ updated_at: string;
38
+ deleted_at: null | string;
29
39
  }
30
40
  //# sourceMappingURL=Customer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Customer.d.ts","sourceRoot":"","sources":["../../../../../src/types/Customer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,C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,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,18 @@
1
+ import type { CreateCustomerRequest } from './types/Customer';
2
+ declare class Accumulator {
3
+ private registerData;
4
+ private __select_time;
5
+ private listener;
6
+ private _isListenerCalledOnce;
7
+ constructor();
8
+ register(externalId: string, listener: (data: CreateCustomerRequest) => Promise<void>): void;
9
+ add(data: Partial<Omit<CreateCustomerRequest, 'externalId'>>): void;
10
+ flush(): Promise<void>;
11
+ debounce(): void;
12
+ reset(): void;
13
+ get(): CreateCustomerRequest | null;
14
+ isListenerCalledOnce(): boolean;
15
+ }
16
+ export declare const accumulator: Accumulator;
17
+ export {};
18
+ //# sourceMappingURL=Accumulator.d.ts.map
@@ -0,0 +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;IAmBtD,KAAK;IAWX,QAAQ;IAaR,KAAK;IAML,GAAG;IAIH,oBAAoB;CAGrB;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../src/api/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,qBAAqB,EACnC,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAOnB"}
1
+ {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../src/api/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,qBAAqB,EACnC,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAQnB"}
@@ -0,0 +1,3 @@
1
+ export declare function collectData(key: string, value: string): void;
2
+ export declare function registerOneSignalForComnyx(onesignal_id: string, external_id: string): void;
3
+ //# sourceMappingURL=collectData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectData.d.ts","sourceRoot":"","sources":["../../../../src/collectData.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QASrD;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,QAUpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatList.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,2CAwnB3D"}
1
+ {"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatList.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,2CAynB3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomerForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/CustomerForm.tsx"],"names":[],"mappings":"AAoCA,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,2CAuR9D"}
1
+ {"version":3,"file":"CustomerForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/CustomerForm.tsx"],"names":[],"mappings":"AAsCA,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,2CA8S9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../../src/data/fake/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5E,wBAAgB,eAAe,CAAC,YAAY,EAAE,qBAAqB,GAAG,QAAQ,CAgB7E"}
1
+ {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../../../../../src/data/fake/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5E,wBAAgB,eAAe,CAAC,YAAY,EAAE,qBAAqB,GAAG,QAAQ,CAe7E"}
@@ -1,4 +1,5 @@
1
1
  import './__dev__';
2
+ export { collectData as collectDataForComnyx, registerOneSignalForComnyx, } from './collectData';
2
3
  export { registerComnyx } from './register';
3
4
  export type { CreateCustomerRequest } from './types/Customer';
4
5
  export { Comnyx } from './App';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AACnB,OAAO,EACL,WAAW,IAAI,oBAAoB,EACnC,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/register.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,eAAe,EAAE;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,QAUA"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/register.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,CAAC,eAAe,EAAE;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,QAmBA"}
@@ -18,7 +18,7 @@ interface AppStoreState {
18
18
  init: ({ externalId }: {
19
19
  externalId: string;
20
20
  }) => void;
21
- initForm: (createCustomerResponse: Customer) => void;
21
+ setCustomer: (createCustomerResponse: Customer) => void;
22
22
  setLanguage: (language: LanguageCode) => void;
23
23
  setTheme: (theme: 'light' | 'dark') => void;
24
24
  setFake: (fake: boolean) => void;
@@ -27,6 +27,8 @@ interface AppStoreState {
27
27
  baseHeight: number;
28
28
  baseWidth: number;
29
29
  }) => void;
30
+ formSubmitted: boolean;
31
+ setForm: (form: Customer) => void;
30
32
  }
31
33
  export declare const useAppStore: import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<import("zustand").StoreApi<AppStoreState>, "persist"> & {
32
34
  persist: {
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC;IACtC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,YAAY,EAAE,sBAAsB,GAAG,IAAI,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alIntegrationParameters {
6
+ onesignal_id: string;
7
+ external_id: string;
8
+ }
9
+ export interface IntegrationParameters {
10
+ onesignal?: OneSignalIntegrationParameters;
11
+ }
5
12
  export interface CreateCustomerRequest {
6
- name: string;
7
- country: string;
8
- language: string;
9
13
  externalId: string;
10
- email: string;
11
- phone: string;
12
- ipAddress: string;
14
+ name?: string;
15
+ country?: string;
16
+ language?: string;
17
+ email?: string;
18
+ phone?: string;
19
+ ipAddress?: string;
13
20
  customParameters?: CustomParameter[];
21
+ integrationParameters?: IntegrationParameters;
14
22
  }
15
23
  export interface Customer {
16
24
  id: number;
17
25
  project_id: number;
18
26
  external_id: string;
19
27
  name: string;
28
+ device: null | string;
20
29
  country: string;
21
30
  language: string;
22
31
  email: string;
@@ -24,7 +33,8 @@ export interface Customer {
24
33
  ip_address: string;
25
34
  custom_parameters: string;
26
35
  user_code: string;
27
- updated_at: string;
28
36
  created_at: string;
37
+ updated_at: string;
38
+ deleted_at: null | string;
29
39
  }
30
40
  //# sourceMappingURL=Customer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Customer.d.ts","sourceRoot":"","sources":["../../../../../src/types/Customer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,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AC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;CAC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@developer_tribe/react-native-comnyx",
3
- "version": "0.3.14",
3
+ "version": "0.4.0",
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",
@@ -0,0 +1,84 @@
1
+ import type { CreateCustomerRequest } from './types/Customer';
2
+
3
+ const ACCUMULATOR_DEBOUNCE_TIME_IN_MS = 3000;
4
+
5
+ class Accumulator {
6
+ private registerData: CreateCustomerRequest | null = null;
7
+ private __select_time: NodeJS.Timeout | undefined = undefined;
8
+ private listener: ((data: CreateCustomerRequest) => Promise<void>) | null =
9
+ null;
10
+ private _isListenerCalledOnce: boolean = false;
11
+ constructor() {}
12
+
13
+ register(
14
+ externalId: string,
15
+ listener: (data: CreateCustomerRequest) => Promise<void>
16
+ ) {
17
+ this.registerData = {
18
+ externalId,
19
+ customParameters: [],
20
+ integrationParameters: {},
21
+ };
22
+ this.listener = listener;
23
+ this.debounce();
24
+ }
25
+
26
+ add(data: Partial<Omit<CreateCustomerRequest, 'externalId'>>) {
27
+ if (!this.registerData) {
28
+ throw new Error('Register data is not set');
29
+ }
30
+ this.registerData = {
31
+ ...this.registerData,
32
+ ...data,
33
+ integrationParameters: {
34
+ ...(this.registerData.integrationParameters || {}),
35
+ ...(data.integrationParameters || {}),
36
+ },
37
+ customParameters: [
38
+ ...(this.registerData.customParameters || []),
39
+ ...(data.customParameters || []),
40
+ ],
41
+ };
42
+ this.debounce();
43
+ }
44
+
45
+ async flush() {
46
+ if (!this.registerData) {
47
+ throw new Error('Register data is not set');
48
+ }
49
+ if (this.listener) {
50
+ await this.listener(this.registerData!);
51
+ this._isListenerCalledOnce = true;
52
+ }
53
+ this.reset();
54
+ }
55
+
56
+ debounce() {
57
+ if (!this.registerData) {
58
+ throw new Error('Register data is not set');
59
+ }
60
+ this.reset();
61
+ this.__select_time = setTimeout(() => {
62
+ if (this.listener) {
63
+ this.listener(this.registerData!);
64
+ this._isListenerCalledOnce = true;
65
+ }
66
+ }, ACCUMULATOR_DEBOUNCE_TIME_IN_MS);
67
+ }
68
+
69
+ reset() {
70
+ if (this.__select_time) {
71
+ clearTimeout(this.__select_time);
72
+ }
73
+ }
74
+
75
+ get() {
76
+ return this.registerData;
77
+ }
78
+
79
+ isListenerCalledOnce() {
80
+ return this._isListenerCalledOnce;
81
+ }
82
+ }
83
+
84
+ export const accumulator = new Accumulator();
package/src/App.tsx CHANGED
@@ -23,9 +23,9 @@ export function Comnyx({
23
23
  onBack,
24
24
  themes,
25
25
  }: ComnyxProps) {
26
- const { initialized, customer } = useAppStore((s) => ({
27
- initialized: s.initialized,
28
- customer: s.customer,
26
+ const { externalId, formSubmitted } = useAppStore((s) => ({
27
+ externalId: s.externalId,
28
+ formSubmitted: s.formSubmitted,
29
29
  }));
30
30
  const themeColors = useThemeColors();
31
31
  usePolling();
@@ -38,7 +38,7 @@ export function Comnyx({
38
38
  }
39
39
  }, [language, theme, fake, themes]);
40
40
 
41
- if (!initialized) {
41
+ if (!externalId) {
42
42
  return (
43
43
  <View
44
44
  style={[styles.container, { backgroundColor: themeColors.background }]}
@@ -46,7 +46,7 @@ export function Comnyx({
46
46
  <AppText localization="app.initialization.required" />
47
47
  </View>
48
48
  );
49
- } else if (!customer) {
49
+ } else if (!formSubmitted) {
50
50
  return <CustomerForm onBack={onBack} />;
51
51
  }
52
52
 
@@ -10,6 +10,7 @@ export function createCustomer(
10
10
  if (options.fake) {
11
11
  return Promise.resolve(getFakeCustomer(customerData));
12
12
  }
13
+ console.info('[Comnyx] Adding customer info');
13
14
  return axiosInstance
14
15
  .post('/api/customers/create', customerData)
15
16
  .then((res) => res.data);
@@ -0,0 +1,26 @@
1
+ import { accumulator } from './Accumulator';
2
+
3
+ export function collectData(key: string, value: string) {
4
+ accumulator.add({
5
+ customParameters: [
6
+ {
7
+ name: key,
8
+ value,
9
+ },
10
+ ],
11
+ });
12
+ }
13
+
14
+ export function registerOneSignalForComnyx(
15
+ onesignal_id: string,
16
+ external_id: string
17
+ ) {
18
+ accumulator.add({
19
+ integrationParameters: {
20
+ onesignal: {
21
+ onesignal_id,
22
+ external_id,
23
+ },
24
+ },
25
+ });
26
+ }
@@ -539,7 +539,7 @@ export function ChatList({ onBack }: { onBack?: () => void }) {
539
539
  return (
540
540
  <>
541
541
  <StatusBar
542
- barStyle={'dark-content'}
542
+ barStyle={'light-content'}
543
543
  backgroundColor={themeColors.background}
544
544
  animated={false}
545
545
  translucent
@@ -631,6 +631,7 @@ export function ChatList({ onBack }: { onBack?: () => void }) {
631
631
  onScroll={handleScroll}
632
632
  scrollEventThrottle={1}
633
633
  stickySectionHeadersEnabled={false}
634
+ showsVerticalScrollIndicator={false}
634
635
  />
635
636
  </View>
636
637
  {isScrollingUp && (
@@ -684,7 +685,8 @@ const styles = ScaledSheet.create({
684
685
  },
685
686
  contentContainer: {
686
687
  paddingHorizontal: '10@s',
687
- paddingVertical: '10@vs',
688
+ paddingTop: '10@vs',
689
+ paddingBottom: '30@vs',
688
690
  flexGrow: 1,
689
691
  },
690
692
  loadingItem: {