@duffel/react-native-components-assistant 0.5.1-canary.0 → 0.5.1-canary.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.
@@ -78,48 +78,59 @@ export const DuffelAssistant = ({
78
78
  Linking.openURL(request.url).catch(() => {});
79
79
  return false;
80
80
  };
81
+ if (Platform.OS === 'android') {
82
+ return /*#__PURE__*/_jsx(Modal, {
83
+ visible: isOpen,
84
+ onRequestClose: () => onClose(),
85
+ animationType: "slide",
86
+ children: /*#__PURE__*/_jsx(KeyboardAvoidingView, {
87
+ behavior: 'padding',
88
+ enabled: true,
89
+ style: styles.keyboardAvoidingView,
90
+ children: /*#__PURE__*/_jsx(View, {
91
+ style: styles.androidContainer,
92
+ children: /*#__PURE__*/_jsx(WebView
93
+ // Required for Android
94
+ , {
95
+ injectedJavaScript: `
96
+ postMessage(
97
+ {
98
+ type: "duffel-assistant-open",
99
+ properties: ${JSON.stringify(properties)},
100
+ },
101
+ "*",
102
+ );
103
+ true;`,
104
+ source: {
105
+ uri: assistantIframeUrl
106
+ },
107
+ onMessage: handleMessage,
108
+ onShouldStartLoadWithRequest: handleShouldStartLoadWithRequest,
109
+ style: styles.webView
110
+ })
111
+ })
112
+ })
113
+ });
114
+ }
81
115
  return /*#__PURE__*/_jsx(Modal, {
82
116
  visible: isOpen,
83
117
  onRequestClose: () => onClose(),
84
118
  animationType: "slide",
85
- children: /*#__PURE__*/_jsx(KeyboardAvoidingView, {
86
- behavior: Platform.OS === 'android' ? 'padding' : undefined,
87
- enabled: Platform.OS === 'android',
88
- style: styles.keyboardAvoidingView,
89
- children: /*#__PURE__*/_jsx(View, {
90
- style: styles.container,
91
- children: Platform.OS === 'ios' ? /*#__PURE__*/_jsx(WebView, {
92
- injectedJavaScriptObject: properties
93
- // When you are running this in development iOS doesn't allow request from hosts with invalid https certificates.
94
- // If you try ngrok with the local esbuild server it will fail because ngrok requests in https and the dev server rejects http requests.
95
- // Easiest solution is to use the production URL with test data.
96
- // If that's not possible, you can also upload the assistant built assets to a different folder in assets.duffel and work with that.
97
- ,
98
- source: {
99
- uri: assistantIframeUrl
100
- },
101
- onMessage: handleMessage,
102
- onShouldStartLoadWithRequest: handleShouldStartLoadWithRequest,
103
- style: styles.webView
104
- }) : /*#__PURE__*/_jsx(WebView
105
- // Required for Android
106
- , {
107
- injectedJavaScript: `
108
- postMessage(
109
- {
110
- type: "duffel-assistant-open",
111
- properties: ${JSON.stringify(properties)},
112
- },
113
- "*",
114
- );
115
- true;`,
116
- source: {
117
- uri: assistantIframeUrl
118
- },
119
- onMessage: handleMessage,
120
- onShouldStartLoadWithRequest: handleShouldStartLoadWithRequest,
121
- style: styles.webView
122
- })
119
+ children: /*#__PURE__*/_jsx(View, {
120
+ style: styles.container,
121
+ children: /*#__PURE__*/_jsx(WebView, {
122
+ injectedJavaScriptObject: properties
123
+ // When you are running this in development iOS doesn't allow request from hosts with invalid https certificates.
124
+ // If you try ngrok with the local esbuild server it will fail because ngrok requests in https and the dev server rejects http requests.
125
+ // Easiest solution is to use the production URL with test data.
126
+ // If that's not possible, you can also upload the assistant built assets to a different folder in assets.duffel and work with that.
127
+ ,
128
+ source: {
129
+ uri: assistantIframeUrl
130
+ },
131
+ onMessage: handleMessage,
132
+ onShouldStartLoadWithRequest: handleShouldStartLoadWithRequest,
133
+ style: styles.webView
123
134
  })
124
135
  })
125
136
  });
@@ -133,7 +144,14 @@ const styles = StyleSheet.create({
133
144
  width: '100%',
134
145
  paddingHorizontal: 12,
135
146
  paddingTop: 50,
136
- paddingBottom: 30
147
+ paddingBottom: 10
148
+ },
149
+ androidContainer: {
150
+ flex: 1,
151
+ width: '100%',
152
+ paddingHorizontal: 12,
153
+ paddingTop: 50,
154
+ paddingBottom: 10
137
155
  },
138
156
  webView: {
139
157
  flex: 1
@@ -1 +1 @@
1
- {"version":3,"names":["React","KeyboardAvoidingView","Linking","Modal","Platform","StyleSheet","View","WebView","hasJsonWebTokenFormat","getClientKeyPayload","jsx","_jsx","assistantIframeUrl","isHttpUrl","url","test","isAssistantIframeUrl","parsedUrl","URL","origin","pathname","error","DuffelAssistant","isOpen","onClose","onNewMessage","properties","clientKey","Error","clientKeyPayload","clientKeyIncludesResource","order_id","undefined","booking_id","cars_booking_id","issueType","console","warn","context","supportChannels","chat","showMinimiseButton","onMinimise","handleMessage","event","nativeEvent","data","parsedData","JSON","parse","type","userId","resourceId","handleShouldStartLoadWithRequest","request","OS","navigationType","openURL","catch","visible","onRequestClose","animationType","children","behavior","enabled","style","styles","keyboardAvoidingView","container","injectedJavaScriptObject","source","uri","onMessage","onShouldStartLoadWithRequest","webView","injectedJavaScript","stringify","create","flex","width","paddingHorizontal","paddingTop","paddingBottom"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,oBAAoB,EACpBC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,UAAU,EACVC,IAAI,QACC,cAAc;AACrB,SAASC,OAAO,QAAQ,sBAAsB;AAE9C,SAASC,qBAAqB,QAAQ,gCAA6B;AACnE,SAASC,mBAAmB,QAAQ,8BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIhE,MAAMC,kBAAkB,GAAG,iDAAiD;AAa5E,MAAMC,SAAS,GAAIC,GAAW,IAAK,cAAc,CAACC,IAAI,CAACD,GAAG,CAAC;AAE3D,MAAME,oBAAoB,GAAIF,GAAW,IAAK;EAC5C,IAAI;IACF,MAAMG,SAAS,GAAG,IAAIC,GAAG,CAACJ,GAAG,CAAC;IAE9B,OAAO,GAAGG,SAAS,CAACE,MAAM,GAAGF,SAAS,CAACG,QAAQ,EAAE,KAAKR,kBAAkB;EAC1E,CAAC,CAAC,OAAOS,KAAK,EAAE;IACd,OAAO,KAAK;EACd;AACF,CAAC;AAED,OAAO,MAAMC,eAA+C,GAAGA,CAAC;EAC9DC,MAAM;EACNC,OAAO;EACPC,YAAY;EACZ,GAAGC;AACL,CA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EACDR,OAAO,EAAE;IACPI,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","KeyboardAvoidingView","Linking","Modal","Platform","StyleSheet","View","WebView","hasJsonWebTokenFormat","getClientKeyPayload","jsx","_jsx","assistantIframeUrl","isHttpUrl","url","test","isAssistantIframeUrl","parsedUrl","URL","origin","pathname","error","DuffelAssistant","isOpen","onClose","onNewMessage","properties","clientKey","Error","clientKeyPayload","clientKeyIncludesResource","order_id","undefined","booking_id","cars_booking_id","issueType","console","warn","context","supportChannels","chat","showMinimiseButton","onMinimise","handleMessage","event","nativeEvent","data","parsedData","JSON","parse","type","userId","resourceId","handleShouldStartLoadWithRequest","request","OS","navigationType","openURL","catch","visible","onRequestClose","animationType","children","behavior","enabled","style","styles","keyboardAvoidingView","androidContainer","injectedJavaScript","stringify","source","uri","onMessage","onShouldStartLoadWithRequest","webView","container","injectedJavaScriptObject","create","flex","width","paddingHorizontal","paddingTop","paddingBottom"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,oBAAoB,EACpBC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,UAAU,EACVC,IAAI,QACC,cAAc;AACrB,SAASC,OAAO,QAAQ,sBAAsB;AAE9C,SAASC,qBAAqB,QAAQ,gCAA6B;AACnE,SAASC,mBAAmB,QAAQ,8BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIhE,MAAMC,kBAAkB,GAAG,iDAAiD;AAa5E,MAAMC,SAAS,GAAIC,GAAW,IAAK,cAAc,CAACC,IAAI,CAACD,GAAG,CAAC;AAE3D,MAAME,oBAAoB,GAAIF,GAAW,IAAK;EAC5C,IAAI;IACF,MAAMG,SAAS,GAAG,IAAIC,GAAG,CAACJ,GAAG,CAAC;IAE9B,OAAO,GAAGG,SAAS,CAACE,MAAM,GAAGF,SAAS,CAACG,QAAQ,EAAE,KAAKR,kBAAkB;EA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gCAAiC;QAC/DY,KAAK,EAAEC,MAAM,CAACS;MAAQ,CACvB;IAAC,CACE;EAAC,CACF,CAAC;AAEZ,CAAC;AAED,MAAMT,MAAM,GAAG7D,UAAU,CAACyE,MAAM,CAAC;EAC/BX,oBAAoB,EAAE;IACpBY,IAAI,EAAE;EACR,CAAC;EACDH,SAAS,EAAE;IACTG,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,MAAM;IACbC,iBAAiB,EAAE,EAAE;IACrBC,UAAU,EAAE,EAAE;IACdC,aAAa,EAAE;EACjB,CAAC;EACDf,gBAAgB,EAAE;IAChBW,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,MAAM;IACbC,iBAAiB,EAAE,EAAE;IACrBC,UAAU,EAAE,EAAE;IACdC,aAAa,EAAE;EACjB,CAAC;EACDR,OAAO,EAAE;IACPI,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,KAAK,oBAAoB,IAAI,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAInG,MAAM,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AA2BhE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAiK1D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,KAAK,oBAAoB,IAAI,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAInG,MAAM,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AA2BhE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA2K1D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duffel/react-native-components-assistant",
3
- "version": "0.5.1-canary.0",
3
+ "version": "0.5.1-canary.1",
4
4
  "description": "Duffel Assistant component in React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/index.tsx CHANGED
@@ -154,50 +154,60 @@ export const DuffelAssistant: React.FC<DuffelAssistantProps> = ({
154
154
  return false;
155
155
  };
156
156
 
157
- return (
158
- <Modal
159
- visible={isOpen}
160
- onRequestClose={() => onClose()}
161
- animationType="slide"
162
- >
163
- <KeyboardAvoidingView
164
- behavior={Platform.OS === 'android' ? 'padding' : undefined}
165
- enabled={Platform.OS === 'android'}
166
- style={styles.keyboardAvoidingView}
157
+ if (Platform.OS === 'android') {
158
+ return (
159
+ <Modal
160
+ visible={isOpen}
161
+ onRequestClose={() => onClose()}
162
+ animationType="slide"
167
163
  >
168
- <View style={styles.container}>
169
- {Platform.OS === 'ios' ? (
170
- <WebView
171
- injectedJavaScriptObject={properties}
172
- // When you are running this in development iOS doesn't allow request from hosts with invalid https certificates.
173
- // If you try ngrok with the local esbuild server it will fail because ngrok requests in https and the dev server rejects http requests.
174
- // Easiest solution is to use the production URL with test data.
175
- // If that's not possible, you can also upload the assistant built assets to a different folder in assets.duffel and work with that.
176
- source={{ uri: assistantIframeUrl }}
177
- onMessage={handleMessage}
178
- onShouldStartLoadWithRequest={handleShouldStartLoadWithRequest}
179
- style={styles.webView}
180
- />
181
- ) : (
164
+ <KeyboardAvoidingView
165
+ behavior={'padding'}
166
+ enabled={true}
167
+ style={styles.keyboardAvoidingView}
168
+ >
169
+ <View style={styles.androidContainer}>
182
170
  <WebView
183
171
  // Required for Android
184
172
  injectedJavaScript={`
185
- postMessage(
186
- {
187
- type: "duffel-assistant-open",
188
- properties: ${JSON.stringify(properties)},
189
- },
190
- "*",
191
- );
192
- true;`}
173
+ postMessage(
174
+ {
175
+ type: "duffel-assistant-open",
176
+ properties: ${JSON.stringify(properties)},
177
+ },
178
+ "*",
179
+ );
180
+ true;`}
193
181
  source={{ uri: assistantIframeUrl }}
194
182
  onMessage={handleMessage}
195
183
  onShouldStartLoadWithRequest={handleShouldStartLoadWithRequest}
196
184
  style={styles.webView}
197
185
  />
198
- )}
199
- </View>
200
- </KeyboardAvoidingView>
186
+ </View>
187
+ </KeyboardAvoidingView>
188
+ </Modal>
189
+ );
190
+ }
191
+
192
+ return (
193
+ <Modal
194
+ visible={isOpen}
195
+ onRequestClose={() => onClose()}
196
+ animationType="slide"
197
+ >
198
+ <View style={styles.container}>
199
+ <WebView
200
+ injectedJavaScriptObject={properties}
201
+ // When you are running this in development iOS doesn't allow request from hosts with invalid https certificates.
202
+ // If you try ngrok with the local esbuild server it will fail because ngrok requests in https and the dev server rejects http requests.
203
+ // Easiest solution is to use the production URL with test data.
204
+ // If that's not possible, you can also upload the assistant built assets to a different folder in assets.duffel and work with that.
205
+ source={{ uri: assistantIframeUrl }}
206
+ onMessage={handleMessage}
207
+ onShouldStartLoadWithRequest={handleShouldStartLoadWithRequest}
208
+ style={styles.webView}
209
+ />
210
+ </View>
201
211
  </Modal>
202
212
  );
203
213
  };
@@ -211,7 +221,14 @@ const styles = StyleSheet.create({
211
221
  width: '100%',
212
222
  paddingHorizontal: 12,
213
223
  paddingTop: 50,
214
- paddingBottom: 30,
224
+ paddingBottom: 10,
225
+ },
226
+ androidContainer: {
227
+ flex: 1,
228
+ width: '100%',
229
+ paddingHorizontal: 12,
230
+ paddingTop: 50,
231
+ paddingBottom: 10,
215
232
  },
216
233
  webView: {
217
234
  flex: 1,