chayns-api 1.0.35 → 1.0.37

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 (34) hide show
  1. package/dist/cjs/calls/dialogs/date.js +28 -0
  2. package/dist/cjs/calls/index.js +70 -65
  3. package/dist/cjs/components/ChaynsProvider.js +5 -7
  4. package/dist/cjs/components/moduleWrapper.js +10 -0
  5. package/dist/cjs/components/withCompatMode.js +1 -1
  6. package/dist/cjs/hooks/useDialogState.js +2 -2
  7. package/dist/cjs/hooks/usePages.js +2 -2
  8. package/dist/cjs/index.js +8 -0
  9. package/dist/cjs/types/IChaynsReact.js +136 -123
  10. package/dist/cjs/util/appCall.js +2 -2
  11. package/dist/cjs/util/deviceHelper.js +3 -3
  12. package/dist/cjs/wrapper/FrameWrapper.js +4 -0
  13. package/dist/cjs/wrapper/StaticChaynsApi.js +23 -0
  14. package/dist/esm/calls/dialogs/date.js +0 -1
  15. package/dist/esm/calls/index.js +7 -1
  16. package/dist/esm/components/ChaynsProvider.js +3 -4
  17. package/dist/esm/components/moduleWrapper.js +3 -0
  18. package/dist/esm/hooks/useDialogState.js +2 -2
  19. package/dist/esm/hooks/usePages.js +1 -1
  20. package/dist/esm/index.js +1 -0
  21. package/dist/esm/types/IChaynsReact.js +114 -99
  22. package/dist/esm/util/appCall.js +2 -2
  23. package/dist/esm/util/deviceHelper.js +3 -3
  24. package/dist/esm/wrapper/FrameWrapper.js +4 -0
  25. package/dist/esm/wrapper/StaticChaynsApi.js +20 -0
  26. package/dist/types/calls/index.d.ts +4 -0
  27. package/dist/types/components/AppDialogWrapper.d.ts +2 -2
  28. package/dist/types/components/ChaynsProvider.d.ts +1 -4
  29. package/dist/types/components/moduleWrapper.d.ts +4 -0
  30. package/dist/types/index.d.ts +1 -0
  31. package/dist/types/types/IChaynsReact.d.ts +19 -2
  32. package/dist/types/wrapper/StaticChaynsApi.d.ts +9 -0
  33. package/package.json +3 -1
  34. package/toolkit.config.js +20 -0
@@ -1,62 +1,71 @@
1
- export let DateType;
2
- (function (DateType) {
1
+ export let DateType = /*#__PURE__*/function (DateType) {
3
2
  DateType[DateType["DATE"] = 0] = "DATE";
4
3
  DateType[DateType["TIME"] = 1] = "TIME";
5
4
  DateType[DateType["DATE_TIME"] = 2] = "DATE_TIME";
6
- })(DateType || (DateType = {}));
7
- export let ToastType;
8
- (function (ToastType) {
5
+ return DateType;
6
+ }({});
7
+ export let ToastType = /*#__PURE__*/function (ToastType) {
9
8
  ToastType[ToastType["NEUTRAL"] = 1] = "NEUTRAL";
10
9
  ToastType[ToastType["SUCCESS"] = 2] = "SUCCESS";
11
10
  ToastType[ToastType["WARNING"] = 3] = "WARNING";
12
11
  ToastType[ToastType["ERROR"] = 4] = "ERROR";
13
- })(ToastType || (ToastType = {}));
14
- export let DialogInputType; // TEXTAREA = 'textarea', TODO Add this type when textarea is implemented in new chayns-components in dialog-v2
15
- (function (DialogInputType) {
12
+ return ToastType;
13
+ }({});
14
+ export let DialogInputType = /*#__PURE__*/function (DialogInputType) {
16
15
  DialogInputType["NUMBER"] = "number";
17
16
  DialogInputType["PASSWORD"] = "password";
18
17
  DialogInputType["TELEPHONE"] = "tel";
19
18
  DialogInputType["TEXT"] = "text";
20
- })(DialogInputType || (DialogInputType = {}));
21
- export let DialogSelectType;
22
- (function (DialogSelectType) {
19
+ DialogInputType["TEXTAREA"] = "textarea";
20
+ return DialogInputType;
21
+ }({});
22
+ export let DialogSelectType = /*#__PURE__*/function (DialogSelectType) {
23
23
  DialogSelectType[DialogSelectType["DEFAULT"] = 0] = "DEFAULT";
24
24
  DialogSelectType[DialogSelectType["ICON"] = 1] = "ICON";
25
- })(DialogSelectType || (DialogSelectType = {}));
26
- export let DialogButtonType;
27
- (function (DialogButtonType) {
25
+ return DialogSelectType;
26
+ }({});
27
+ export let DialogButtonType = /*#__PURE__*/function (DialogButtonType) {
28
28
  DialogButtonType[DialogButtonType["OK"] = 1] = "OK";
29
29
  DialogButtonType[DialogButtonType["CANCEL"] = -1] = "CANCEL";
30
30
  DialogButtonType[DialogButtonType["NEGATIVE"] = 0] = "NEGATIVE";
31
- })(DialogButtonType || (DialogButtonType = {}));
32
- export let ScreenSize;
33
- (function (ScreenSize) {
31
+ return DialogButtonType;
32
+ }({});
33
+ export let ScreenSize = /*#__PURE__*/function (ScreenSize) {
34
34
  ScreenSize[ScreenSize["XS"] = 0] = "XS";
35
35
  ScreenSize[ScreenSize["SM"] = 1] = "SM";
36
36
  ScreenSize[ScreenSize["MD"] = 2] = "MD";
37
37
  ScreenSize[ScreenSize["LG"] = 3] = "LG";
38
38
  ScreenSize[ScreenSize["XL"] = 4] = "XL";
39
- })(ScreenSize || (ScreenSize = {}));
40
- export let AccessMode;
41
- (function (AccessMode) {
39
+ return ScreenSize;
40
+ }({});
41
+
42
+ /**
43
+ * @ignore
44
+ */
45
+
46
+ /**
47
+ * @ignore
48
+ */
49
+
50
+ export let AccessMode = /*#__PURE__*/function (AccessMode) {
42
51
  AccessMode[AccessMode["public"] = 0] = "public";
43
52
  AccessMode[AccessMode["protected"] = 1] = "protected";
44
53
  AccessMode[AccessMode["private"] = 2] = "private";
45
- })(AccessMode || (AccessMode = {}));
46
- export let ScanQrCodeCodeType;
47
- (function (ScanQrCodeCodeType) {
54
+ return AccessMode;
55
+ }({});
56
+ export let ScanQrCodeCodeType = /*#__PURE__*/function (ScanQrCodeCodeType) {
48
57
  ScanQrCodeCodeType[ScanQrCodeCodeType["QR"] = 0] = "QR";
49
58
  ScanQrCodeCodeType[ScanQrCodeCodeType["BARCODE"] = 0] = "BARCODE";
50
59
  ScanQrCodeCodeType[ScanQrCodeCodeType["ALL"] = 2] = "ALL";
51
- })(ScanQrCodeCodeType || (ScanQrCodeCodeType = {}));
52
- export let ScanQrCodeCameraTypes;
53
- (function (ScanQrCodeCameraTypes) {
60
+ return ScanQrCodeCodeType;
61
+ }({});
62
+ export let ScanQrCodeCameraTypes = /*#__PURE__*/function (ScanQrCodeCameraTypes) {
54
63
  ScanQrCodeCameraTypes[ScanQrCodeCameraTypes["AUTO"] = 0] = "AUTO";
55
64
  ScanQrCodeCameraTypes[ScanQrCodeCameraTypes["BACK"] = 1] = "BACK";
56
65
  ScanQrCodeCameraTypes[ScanQrCodeCameraTypes["FRONT"] = 2] = "FRONT";
57
- })(ScanQrCodeCameraTypes || (ScanQrCodeCameraTypes = {}));
58
- var IOSFeedbackVibration;
59
- (function (IOSFeedbackVibration) {
66
+ return ScanQrCodeCameraTypes;
67
+ }({});
68
+ var IOSFeedbackVibration = /*#__PURE__*/function (IOSFeedbackVibration) {
60
69
  IOSFeedbackVibration[IOSFeedbackVibration["Unknown"] = 0] = "Unknown";
61
70
  IOSFeedbackVibration[IOSFeedbackVibration["SelectionChanged"] = 1] = "SelectionChanged";
62
71
  IOSFeedbackVibration[IOSFeedbackVibration["NotificationError"] = 2] = "NotificationError";
@@ -67,25 +76,25 @@ var IOSFeedbackVibration;
67
76
  IOSFeedbackVibration[IOSFeedbackVibration["Heavy"] = 7] = "Heavy";
68
77
  IOSFeedbackVibration[IOSFeedbackVibration["Soft"] = 8] = "Soft";
69
78
  IOSFeedbackVibration[IOSFeedbackVibration["Rigid"] = 9] = "Rigid";
70
- })(IOSFeedbackVibration || (IOSFeedbackVibration = {}));
79
+ return IOSFeedbackVibration;
80
+ }(IOSFeedbackVibration || {});
71
81
  // region design settings
72
- var SnapshotType;
73
- (function (SnapshotType) {
82
+ var SnapshotType = /*#__PURE__*/function (SnapshotType) {
74
83
  SnapshotType["Background"] = "background";
75
84
  SnapshotType["Settings"] = "settings";
76
85
  SnapshotType["ColorScheme"] = "colorScheme";
77
86
  SnapshotType["Cover"] = "cover";
78
87
  SnapshotType["Tapp"] = "tapp";
79
- })(SnapshotType || (SnapshotType = {}));
80
- var DesignSettingsUpdateBackgroundType;
81
- (function (DesignSettingsUpdateBackgroundType) {
88
+ return SnapshotType;
89
+ }(SnapshotType || {});
90
+ var DesignSettingsUpdateBackgroundType = /*#__PURE__*/function (DesignSettingsUpdateBackgroundType) {
82
91
  DesignSettingsUpdateBackgroundType[DesignSettingsUpdateBackgroundType["None"] = 0] = "None";
83
92
  DesignSettingsUpdateBackgroundType[DesignSettingsUpdateBackgroundType["Image"] = 1] = "Image";
84
93
  DesignSettingsUpdateBackgroundType[DesignSettingsUpdateBackgroundType["Video"] = 2] = "Video";
85
94
  DesignSettingsUpdateBackgroundType[DesignSettingsUpdateBackgroundType["Color"] = 3] = "Color";
86
- })(DesignSettingsUpdateBackgroundType || (DesignSettingsUpdateBackgroundType = {}));
87
- var DesignSettingsUpdateSeasonTypes;
88
- (function (DesignSettingsUpdateSeasonTypes) {
95
+ return DesignSettingsUpdateBackgroundType;
96
+ }(DesignSettingsUpdateBackgroundType || {});
97
+ var DesignSettingsUpdateSeasonTypes = /*#__PURE__*/function (DesignSettingsUpdateSeasonTypes) {
89
98
  DesignSettingsUpdateSeasonTypes[DesignSettingsUpdateSeasonTypes["None"] = 0] = "None";
90
99
  DesignSettingsUpdateSeasonTypes[DesignSettingsUpdateSeasonTypes["Snowm"] = 1] = "Snowm";
91
100
  DesignSettingsUpdateSeasonTypes[DesignSettingsUpdateSeasonTypes["Confetti"] = 2] = "Confetti";
@@ -95,88 +104,88 @@ var DesignSettingsUpdateSeasonTypes;
95
104
  DesignSettingsUpdateSeasonTypes[DesignSettingsUpdateSeasonTypes["Eastern"] = 6] = "Eastern";
96
105
  DesignSettingsUpdateSeasonTypes[DesignSettingsUpdateSeasonTypes["Clover"] = 7] = "Clover";
97
106
  DesignSettingsUpdateSeasonTypes[DesignSettingsUpdateSeasonTypes["Coins"] = 8] = "Coins";
98
- })(DesignSettingsUpdateSeasonTypes || (DesignSettingsUpdateSeasonTypes = {}));
99
- var DesignSettingsUpdateGalleryAnimationTypes;
100
- (function (DesignSettingsUpdateGalleryAnimationTypes) {
107
+ return DesignSettingsUpdateSeasonTypes;
108
+ }(DesignSettingsUpdateSeasonTypes || {});
109
+ var DesignSettingsUpdateGalleryAnimationTypes = /*#__PURE__*/function (DesignSettingsUpdateGalleryAnimationTypes) {
101
110
  DesignSettingsUpdateGalleryAnimationTypes[DesignSettingsUpdateGalleryAnimationTypes["Swipe"] = 0] = "Swipe";
102
111
  DesignSettingsUpdateGalleryAnimationTypes[DesignSettingsUpdateGalleryAnimationTypes["Fade"] = 1] = "Fade";
103
112
  DesignSettingsUpdateGalleryAnimationTypes[DesignSettingsUpdateGalleryAnimationTypes["Parallax"] = 2] = "Parallax";
104
113
  DesignSettingsUpdateGalleryAnimationTypes[DesignSettingsUpdateGalleryAnimationTypes["KenBurns"] = 3] = "KenBurns";
105
- })(DesignSettingsUpdateGalleryAnimationTypes || (DesignSettingsUpdateGalleryAnimationTypes = {}));
106
- var DesignSettingsUpdateCoverTypes;
107
- (function (DesignSettingsUpdateCoverTypes) {
114
+ return DesignSettingsUpdateGalleryAnimationTypes;
115
+ }(DesignSettingsUpdateGalleryAnimationTypes || {});
116
+ var DesignSettingsUpdateCoverTypes = /*#__PURE__*/function (DesignSettingsUpdateCoverTypes) {
108
117
  DesignSettingsUpdateCoverTypes[DesignSettingsUpdateCoverTypes["Image"] = 0] = "Image";
109
118
  DesignSettingsUpdateCoverTypes[DesignSettingsUpdateCoverTypes["Video"] = 1] = "Video";
110
119
  DesignSettingsUpdateCoverTypes[DesignSettingsUpdateCoverTypes["Slideshow"] = 2] = "Slideshow";
111
120
  DesignSettingsUpdateCoverTypes[DesignSettingsUpdateCoverTypes["Frame"] = 3] = "Frame";
112
121
  DesignSettingsUpdateCoverTypes[DesignSettingsUpdateCoverTypes["None"] = 4] = "None";
113
- })(DesignSettingsUpdateCoverTypes || (DesignSettingsUpdateCoverTypes = {}));
114
- var DesignSettingsUpdateColorSchemeMode;
115
- (function (DesignSettingsUpdateColorSchemeMode) {
122
+ return DesignSettingsUpdateCoverTypes;
123
+ }(DesignSettingsUpdateCoverTypes || {});
124
+ var DesignSettingsUpdateColorSchemeMode = /*#__PURE__*/function (DesignSettingsUpdateColorSchemeMode) {
116
125
  DesignSettingsUpdateColorSchemeMode[DesignSettingsUpdateColorSchemeMode["Normal"] = 0] = "Normal";
117
126
  DesignSettingsUpdateColorSchemeMode[DesignSettingsUpdateColorSchemeMode["Dark"] = 1] = "Dark";
118
127
  DesignSettingsUpdateColorSchemeMode[DesignSettingsUpdateColorSchemeMode["Bright"] = 2] = "Bright";
119
- })(DesignSettingsUpdateColorSchemeMode || (DesignSettingsUpdateColorSchemeMode = {}));
120
- var DesignSettingsUpdateTappViewModes;
121
- (function (DesignSettingsUpdateTappViewModes) {
128
+ return DesignSettingsUpdateColorSchemeMode;
129
+ }(DesignSettingsUpdateColorSchemeMode || {});
130
+ var DesignSettingsUpdateTappViewModes = /*#__PURE__*/function (DesignSettingsUpdateTappViewModes) {
122
131
  DesignSettingsUpdateTappViewModes[DesignSettingsUpdateTappViewModes["Normal"] = 0] = "Normal";
123
132
  DesignSettingsUpdateTappViewModes[DesignSettingsUpdateTappViewModes["Exclusive"] = 1] = "Exclusive";
124
133
  DesignSettingsUpdateTappViewModes[DesignSettingsUpdateTappViewModes["Wide"] = 2] = "Wide";
125
134
  DesignSettingsUpdateTappViewModes[DesignSettingsUpdateTappViewModes["Fullscreen"] = 3] = "Fullscreen";
126
135
  DesignSettingsUpdateTappViewModes[DesignSettingsUpdateTappViewModes["FullscreenWithBackground"] = 4] = "FullscreenWithBackground";
127
- })(DesignSettingsUpdateTappViewModes || (DesignSettingsUpdateTappViewModes = {}));
128
- var LoginState;
129
- (function (LoginState) {
136
+ return DesignSettingsUpdateTappViewModes;
137
+ }(DesignSettingsUpdateTappViewModes || {}); // endregion
138
+ var LoginState = /*#__PURE__*/function (LoginState) {
130
139
  LoginState[LoginState["FACEBOOK"] = 0] = "FACEBOOK";
131
140
  LoginState[LoginState["T_WEB"] = 1] = "T_WEB";
132
141
  LoginState[LoginState["LoginFailed"] = 2] = "LoginFailed";
133
142
  LoginState[LoginState["AlreadyLoggedIn"] = 3] = "AlreadyLoggedIn";
134
143
  LoginState[LoginState["SUCCESS"] = 4] = "SUCCESS";
135
- })(LoginState || (LoginState = {}));
136
- export let FloatingButtonPosition;
137
- (function (FloatingButtonPosition) {
144
+ return LoginState;
145
+ }(LoginState || {});
146
+ export let FloatingButtonPosition = /*#__PURE__*/function (FloatingButtonPosition) {
138
147
  FloatingButtonPosition[FloatingButtonPosition["Right"] = 0] = "Right";
139
148
  FloatingButtonPosition[FloatingButtonPosition["Center"] = 1] = "Center";
140
149
  FloatingButtonPosition[FloatingButtonPosition["Left"] = 2] = "Left";
141
- })(FloatingButtonPosition || (FloatingButtonPosition = {}));
142
- export let SharingApp;
143
- (function (SharingApp) {
150
+ return FloatingButtonPosition;
151
+ }({});
152
+ export let SharingApp = /*#__PURE__*/function (SharingApp) {
144
153
  SharingApp[SharingApp["Mail"] = 0] = "Mail";
145
154
  SharingApp[SharingApp["WhatsApp"] = 1] = "WhatsApp";
146
155
  SharingApp[SharingApp["Facebook"] = 2] = "Facebook";
147
156
  SharingApp[SharingApp["FacebookMessenger"] = 3] = "FacebookMessenger";
148
157
  SharingApp[SharingApp["GooglePlus"] = 4] = "GooglePlus";
149
158
  SharingApp[SharingApp["Twitter"] = 5] = "Twitter";
150
- })(SharingApp || (SharingApp = {}));
151
- export let TappEvent;
152
- (function (TappEvent) {
159
+ return SharingApp;
160
+ }({});
161
+ export let TappEvent = /*#__PURE__*/function (TappEvent) {
153
162
  TappEvent[TappEvent["OnShow"] = 0] = "OnShow";
154
163
  TappEvent[TappEvent["OnHide"] = 1] = "OnHide";
155
164
  TappEvent[TappEvent["OnRefresh"] = 2] = "OnRefresh";
156
165
  TappEvent[TappEvent["OnOpenCcScanner"] = 3] = "OnOpenCcScanner";
157
166
  TappEvent[TappEvent["OnCloseCcScanner"] = 4] = "OnCloseCcScanner";
158
- })(TappEvent || (TappEvent = {}));
159
- export let IconType;
160
- (function (IconType) {
167
+ return TappEvent;
168
+ }({});
169
+ export let IconType = /*#__PURE__*/function (IconType) {
161
170
  IconType[IconType["Font"] = 0] = "Font";
162
171
  IconType[IconType["Base64"] = 1] = "Base64";
163
172
  IconType[IconType["Url"] = 2] = "Url";
164
- })(IconType || (IconType = {}));
165
- export let Gender;
166
- (function (Gender) {
173
+ return IconType;
174
+ }({});
175
+ export let Gender = /*#__PURE__*/function (Gender) {
167
176
  Gender[Gender["Unknown"] = 0] = "Unknown";
168
177
  Gender[Gender["male"] = 1] = "male";
169
178
  Gender[Gender["female"] = 2] = "female";
170
179
  Gender[Gender["diverse"] = 9] = "diverse";
171
- })(Gender || (Gender = {}));
172
- export let ColorMode;
173
- (function (ColorMode) {
180
+ return Gender;
181
+ }({});
182
+ export let ColorMode = /*#__PURE__*/function (ColorMode) {
174
183
  ColorMode[ColorMode["Classic"] = 0] = "Classic";
175
184
  ColorMode[ColorMode["Dark"] = 1] = "Dark";
176
185
  ColorMode[ColorMode["Light"] = 2] = "Light";
177
- })(ColorMode || (ColorMode = {}));
178
- export let Language;
179
- (function (Language) {
186
+ return ColorMode;
187
+ }({});
188
+ export let Language = /*#__PURE__*/function (Language) {
180
189
  Language["Unknown"] = "unknown";
181
190
  Language["German"] = "de";
182
191
  Language["English"] = "en";
@@ -188,51 +197,51 @@ export let Language;
188
197
  Language["Turkish"] = "tr";
189
198
  Language["Polish"] = "pl";
190
199
  Language["Ukrainian"] = "uk";
191
- })(Language || (Language = {}));
192
- export let RuntimeEnviroment;
193
- (function (RuntimeEnviroment) {
200
+ return Language;
201
+ }({});
202
+ export let RuntimeEnviroment = /*#__PURE__*/function (RuntimeEnviroment) {
194
203
  RuntimeEnviroment[RuntimeEnviroment["Unknown"] = 0] = "Unknown";
195
204
  RuntimeEnviroment[RuntimeEnviroment["ChaynsDe"] = 1] = "ChaynsDe";
196
205
  RuntimeEnviroment[RuntimeEnviroment["ChaynsWeb"] = 2] = "ChaynsWeb";
197
206
  RuntimeEnviroment[RuntimeEnviroment["ChaynsRuntime"] = 3] = "ChaynsRuntime";
198
207
  RuntimeEnviroment[RuntimeEnviroment["IntercomPlugin"] = 4] = "IntercomPlugin";
199
208
  RuntimeEnviroment[RuntimeEnviroment["PagemakerPlugin"] = 5] = "PagemakerPlugin";
200
- })(RuntimeEnviroment || (RuntimeEnviroment = {}));
201
- export let DeviceOs;
202
- (function (DeviceOs) {
209
+ return RuntimeEnviroment;
210
+ }({});
211
+ export let DeviceOs = /*#__PURE__*/function (DeviceOs) {
203
212
  DeviceOs["Unknown"] = "unknown";
204
213
  DeviceOs["Android"] = "android";
205
214
  DeviceOs["IOS"] = "ios";
206
215
  DeviceOs["Windows"] = "windows";
207
216
  DeviceOs["MacOs"] = "macos";
208
217
  DeviceOs["Linux"] = "linux";
209
- })(DeviceOs || (DeviceOs = {}));
210
- export let AppName;
211
- (function (AppName) {
218
+ return DeviceOs;
219
+ }({});
220
+ export let AppName = /*#__PURE__*/function (AppName) {
212
221
  AppName[AppName["Unknown"] = 0] = "Unknown";
213
222
  AppName[AppName["David"] = 1] = "David";
214
223
  AppName[AppName["Chayns"] = 2] = "Chayns";
215
224
  AppName[AppName["Location"] = 3] = "Location";
216
225
  AppName[AppName["Intercom"] = 4] = "Intercom";
217
226
  AppName[AppName["ChaynsLauncher"] = 5] = "ChaynsLauncher";
218
- })(AppName || (AppName = {}));
219
- export let BrowserName;
220
- (function (BrowserName) {
227
+ return AppName;
228
+ }({});
229
+ export let BrowserName = /*#__PURE__*/function (BrowserName) {
221
230
  BrowserName["Unknown"] = "unknown";
222
231
  BrowserName["Chrome"] = "chrome";
223
232
  BrowserName["Safari"] = "safari";
224
233
  BrowserName["Firefox"] = "firefox";
225
234
  BrowserName["Edge"] = "edge";
226
- })(BrowserName || (BrowserName = {}));
227
- export let Environment;
228
- (function (Environment) {
235
+ return BrowserName;
236
+ }({});
237
+ export let Environment = /*#__PURE__*/function (Environment) {
229
238
  Environment[Environment["Development"] = 0] = "Development";
230
239
  Environment[Environment["Qa"] = 1] = "Qa";
231
240
  Environment[Environment["Staging"] = 2] = "Staging";
232
241
  Environment[Environment["Production"] = 3] = "Production";
233
- })(Environment || (Environment = {}));
234
- export let Font;
235
- (function (Font) {
242
+ return Environment;
243
+ }({});
244
+ export let Font = /*#__PURE__*/function (Font) {
236
245
  Font[Font["Unknown"] = 0] = "Unknown";
237
246
  Font[Font["Roboto"] = 1] = "Roboto";
238
247
  Font[Font["OpenSans"] = 2] = "OpenSans";
@@ -261,14 +270,14 @@ export let Font;
261
270
  Font[Font["RobotoBold"] = 25] = "RobotoBold";
262
271
  Font[Font["RobotoRegular"] = 26] = "RobotoRegular";
263
272
  Font[Font["Inter"] = 27] = "Inter";
264
- })(Font || (Font = {}));
265
- var selectType;
266
- (function (selectType) {
273
+ return Font;
274
+ }({});
275
+ var selectType = /*#__PURE__*/function (selectType) {
267
276
  selectType[selectType["DEFAULT"] = 0] = "DEFAULT";
268
277
  selectType[selectType["ICON"] = 1] = "ICON";
269
- })(selectType || (selectType = {}));
270
- export let DialogType;
271
- (function (DialogType) {
278
+ return selectType;
279
+ }(selectType || {});
280
+ export let DialogType = /*#__PURE__*/function (DialogType) {
272
281
  DialogType["ALERT"] = "alert";
273
282
  DialogType["CONFIRM"] = "confirm";
274
283
  DialogType["DATE"] = "date";
@@ -278,4 +287,10 @@ export let DialogType;
278
287
  DialogType["INPUT"] = "input";
279
288
  DialogType["SELECT"] = "select";
280
289
  DialogType["TOAST"] = "toast";
281
- })(DialogType || (DialogType = {}));
290
+ return DialogType;
291
+ }({});
292
+ export let MediaType = /*#__PURE__*/function (MediaType) {
293
+ MediaType["IMAGE"] = "image";
294
+ MediaType["VIDEO"] = "video";
295
+ return MediaType;
296
+ }({});
@@ -1,9 +1,9 @@
1
1
  // @ts-nocheck
2
2
 
3
3
  const invokeAppCall = call => {
4
- var _window$webkit, _window$webkit$messag, _window$chaynsApp, _window$chaynsElectro;
4
+ var _window$webkit, _window$chaynsApp, _window$chaynsElectro;
5
5
  call = JSON.stringify(call);
6
- if ((_window$webkit = window.webkit) !== null && _window$webkit !== void 0 && (_window$webkit$messag = _window$webkit.messageHandlers) !== null && _window$webkit$messag !== void 0 && _window$webkit$messag.jsonCall) {
6
+ if ((_window$webkit = window.webkit) !== null && _window$webkit !== void 0 && (_window$webkit = _window$webkit.messageHandlers) !== null && _window$webkit !== void 0 && _window$webkit.jsonCall) {
7
7
  window.webkit.messageHandlers.jsonCall.postMessage(call);
8
8
  } else if ((_window$chaynsApp = window.chaynsApp) !== null && _window$chaynsApp !== void 0 && _window$chaynsApp.jsonCall) {
9
9
  window.chaynsApp.jsonCall(call);
@@ -5,9 +5,9 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
5
5
  const parsedUA = parseUserAgent(userAgent);
6
6
  let appName = AppName.Unknown;
7
7
  const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
8
- if ((match === null || match === void 0 ? void 0 : (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
8
+ if ((match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
9
9
  appName = AppName.Chayns;
10
- } else if ((match === null || match === void 0 ? void 0 : (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2.siteId) === '77892-10814') {
10
+ } else if ((match === null || match === void 0 || (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2.siteId) === '77892-10814') {
11
11
  appName = AppName.David;
12
12
  } else if (match) {
13
13
  appName = AppName.Location;
@@ -18,7 +18,7 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
18
18
  result.browser = {
19
19
  name: parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.name,
20
20
  version: parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.version,
21
- majorVersion: Number.parseInt((_parsedUA$version$spl = parsedUA === null || parsedUA === void 0 ? void 0 : (_parsedUA$version = parsedUA.version) === null || _parsedUA$version === void 0 ? void 0 : _parsedUA$version.split('.')[0]) !== null && _parsedUA$version$spl !== void 0 ? _parsedUA$version$spl : '0', 10) || 0,
21
+ majorVersion: Number.parseInt((_parsedUA$version$spl = parsedUA === null || parsedUA === void 0 || (_parsedUA$version = parsedUA.version) === null || _parsedUA$version === void 0 ? void 0 : _parsedUA$version.split('.')[0]) !== null && _parsedUA$version$spl !== void 0 ? _parsedUA$version$spl : '0', 10) || 0,
22
22
  isWebPSupported: acceptHeader.includes('image/webp')
23
23
  };
24
24
  result.app = {
@@ -99,6 +99,10 @@ export class FrameWrapper {
99
99
  if (!this.initialized) await this.ready;
100
100
  return this.exposedFunctions.openImage(value);
101
101
  },
102
+ openMedia: async value => {
103
+ if (!this.initialized) await this.ready;
104
+ return this.exposedFunctions.openMedia(value);
105
+ },
102
106
  openUrl: async value => {
103
107
  if (!this.initialized) await this.ready;
104
108
  return this.exposedFunctions.openUrl(value);
@@ -0,0 +1,20 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { moduleWrapper } from '../components/moduleWrapper';
5
+ import { FrameWrapper } from './FrameWrapper';
6
+ class StaticChaynsApi {
7
+ constructor() {
8
+ _defineProperty(this, "getSite", () => this._wrapper.values.site);
9
+ const wrapper = new FrameWrapper();
10
+ moduleWrapper.current = wrapper;
11
+ this._wrapper = wrapper;
12
+ this.ready = wrapper.init();
13
+ this.addDataListener = wrapper.addDataListener;
14
+ Object.entries(wrapper.functions).forEach(_ref => {
15
+ let [k, v] = _ref;
16
+ this[k] = v;
17
+ });
18
+ }
19
+ }
20
+ export default StaticChaynsApi;
@@ -75,6 +75,10 @@ export declare const navigateBack: () => Promise<void>;
75
75
  * The images specified in the url array is shown in gallery mode.
76
76
  */
77
77
  export declare const openImage: (value: import("../types/IChaynsReact").OpenImage) => Promise<void>;
78
+ /**
79
+ * The images and videos specified in the items array is shown in gallery mode.
80
+ */
81
+ export declare const openMedia: (value: import("../types/IChaynsReact").OpenMedia) => Promise<void>;
78
82
  /**
79
83
  * Opens an URL in the chayns environment.
80
84
  */
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  declare const AppDialogWrapper: ({ dialogEventTarget }: {
3
3
  dialogEventTarget: any;
4
- }) => JSX.Element;
4
+ }) => React.JSX.Element;
5
5
  export default AppDialogWrapper;
@@ -1,8 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { ChaynsReactFunctions, ChaynsReactValues, IChaynsReact } from '../types/IChaynsReact';
3
- export declare const moduleWrapper: {
4
- current: IChaynsReact;
5
- };
2
+ import { ChaynsReactFunctions, ChaynsReactValues } from '../types/IChaynsReact';
6
3
  type ChaynsProviderProps = {
7
4
  data?: ChaynsReactValues;
8
5
  functions?: ChaynsReactFunctions;
@@ -0,0 +1,4 @@
1
+ import { IChaynsReact } from '../types/IChaynsReact';
2
+ export declare const moduleWrapper: {
3
+ current: IChaynsReact;
4
+ };
@@ -8,6 +8,7 @@ export * from './hooks';
8
8
  export * from './components/WaitUntil';
9
9
  export * from './types/IChaynsReact';
10
10
  export * from './components/withCompatMode';
11
+ export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
11
12
  export { default as DialogHandler } from './handler/DialogHandler';
12
13
  export * as dialog from './calls/dialogs/index';
13
14
  export * from './types/IChaynsReact';
@@ -69,7 +69,8 @@ export declare enum DialogInputType {
69
69
  NUMBER = "number",
70
70
  PASSWORD = "password",
71
71
  TELEPHONE = "tel",
72
- TEXT = "text"
72
+ TEXT = "text",
73
+ TEXTAREA = "textarea"
73
74
  }
74
75
  export interface DialogInput {
75
76
  type: DialogType.INPUT;
@@ -230,6 +231,7 @@ export interface ChaynsReactFunctions {
230
231
  openImage: (value: OpenImage) => Promise<void>;
231
232
  openUrl: (value: OpenUrl) => Promise<void>;
232
233
  openVideo: (value: OpenVideo) => Promise<void>;
234
+ openMedia: (value: OpenMedia) => Promise<void>;
233
235
  refreshData: (value: RefreshData) => Promise<void>;
234
236
  refreshAccessToken: () => Promise<void>;
235
237
  removeGeoLocationListener: (value: number) => Promise<void>;
@@ -486,7 +488,7 @@ export type UserInfoQuery = {
486
488
  personId?: string;
487
489
  userId: number;
488
490
  };
489
- type OpenImageItem = {
491
+ export type OpenImageItem = {
490
492
  url: string;
491
493
  title?: string;
492
494
  description?: string;
@@ -762,4 +764,19 @@ export declare enum DialogType {
762
764
  SELECT = "select",
763
765
  TOAST = "toast"
764
766
  }
767
+ export declare enum MediaType {
768
+ IMAGE = "image",
769
+ VIDEO = "video"
770
+ }
771
+ export type OpenMediaItem = {
772
+ url: string;
773
+ title?: string;
774
+ description?: string;
775
+ preventCache?: boolean;
776
+ mediaType: MediaType;
777
+ };
778
+ export type OpenMedia = {
779
+ items: [OpenMediaItem, ...OpenMediaItem[]];
780
+ startIndex?: number;
781
+ };
765
782
  export {};
@@ -0,0 +1,9 @@
1
+ import { DataChangeCallback } from '../types/IChaynsReact';
2
+ declare class StaticChaynsApi {
3
+ ready: Promise<void>;
4
+ addDataListener: (cb: DataChangeCallback) => () => void;
5
+ private _wrapper;
6
+ constructor();
7
+ getSite: () => any;
8
+ }
9
+ export default StaticChaynsApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -12,6 +12,7 @@
12
12
  ],
13
13
  "scripts": {
14
14
  "start": "npm run dev",
15
+ "build:umd": "chayns-toolkit build",
15
16
  "build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir dist/cjs --extensions=.ts,.tsx",
16
17
  "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --extensions=.ts,.tsx",
17
18
  "build-docs": "npm i && cd website && npm i && npm run build",
@@ -60,6 +61,7 @@
60
61
  "@types/react": "^18.0.28",
61
62
  "@types/react-dom": "^18.0.10",
62
63
  "@typescript-eslint/parser": "^5.50.0",
64
+ "chayns-toolkit": "^2.0.8",
63
65
  "concurrently": "^7.6.0",
64
66
  "cross-env": "^7.0.3",
65
67
  "postcss-prefix-selector": "^1.13.0",
@@ -0,0 +1,20 @@
1
+ const path = require('path');
2
+
3
+ module.exports = {
4
+ development: {
5
+ host: "0.0.0.0",
6
+ port: 8081,
7
+ },
8
+ output: {
9
+ singleBundle: true,
10
+ filename: 'chayns-api.js',
11
+ path: path.resolve(__dirname, 'dist'),
12
+ },
13
+ webpack(config) {
14
+ config.output.library = {
15
+ name: 'ChaynsApi',
16
+ type: 'umd',
17
+ }
18
+ return config;
19
+ }
20
+ };