muba-posting 6.0.28 → 7.0.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 (2) hide show
  1. package/Posting.js +26 -6
  2. package/package.json +17 -17
package/Posting.js CHANGED
@@ -66,6 +66,7 @@ export default class Posting extends React.Component {
66
66
  params: null,
67
67
  locationList: [],
68
68
  showRatePopup: false,
69
+ originalAd: null,
69
70
  postingAd: {
70
71
  transaction: null,
71
72
  adType: null,
@@ -221,10 +222,12 @@ export default class Posting extends React.Component {
221
222
  } else {
222
223
  const pendingAd = await this.props.request(this.props.context, LOAD_PENDING_CREATED, { businessId: this.state.businessId });
223
224
  if (pendingAd.httpStatus === 200) {
225
+ delete pendingAd.phones;
224
226
  const languages = pendingAd?.languages.length > 0 ? pendingAd?.languages : this.state.postingAd.languages
225
227
  const languageId = languages[0].language;
226
228
  await this.setState({
227
- postingAd: { ...this.state.postingAd, ...pendingAd, languageId: languageId, languages: languages }
229
+ postingAd: { ...this.state.postingAd, ...pendingAd, languageId: languageId, languages: languages },
230
+ originalAd: { ...this.state.postingAd, ...pendingAd, languageId: languageId, languages: languages }
228
231
  });
229
232
  }
230
233
 
@@ -271,7 +274,8 @@ export default class Posting extends React.Component {
271
274
  if (responseJson.httpStatus === 200) {
272
275
  this.setState({
273
276
  businessId: responseJson.value,
274
- postingAd: { ...this.state.postingAd, businessId: responseJson.value }
277
+ postingAd: { ...this.state.postingAd, businessId: responseJson.value },
278
+ originalAd: { ...this.state.postingAd, businessId: responseJson.value }
275
279
  });
276
280
  }
277
281
  }
@@ -287,18 +291,21 @@ export default class Posting extends React.Component {
287
291
 
288
292
  async loadAd() {
289
293
  const bddAd = await this.getAd(this.state.adId);
294
+ delete bddAd.phones;
290
295
  if (bddAd.status === 'PENDING_CREATED') {
291
296
  const languages = bddAd?.languages.length > 0 ? bddAd?.languages : this.state.postingAd.languages
292
297
  const languageId = languages[0].language;
293
298
  await this.setState({
294
299
  postingAd: { ...this.state.postingAd, ...bddAd, languageId: languageId, languages: languages },
300
+ originalAd: { ...this.state.postingAd, ...bddAd, languageId: languageId, languages: languages },
295
301
  adId: null,
296
302
  originView: Views.PUBLISH_1,
297
303
  fullPosting: true
298
304
  })
299
305
  } else {
300
306
  await this.setState({
301
- postingAd: { ...this.state.postingAd, ...bddAd }
307
+ postingAd: { ...this.state.postingAd, ...bddAd },
308
+ originalAd: { ...this.state.postingAd, ...bddAd }
302
309
  });
303
310
  }
304
311
  }
@@ -320,7 +327,8 @@ export default class Posting extends React.Component {
320
327
  images = response[UPLOADED_FILES_KEY];
321
328
  }
322
329
  await this.setState({
323
- postingAd: { ...this.state.postingAd, images: images, id: response.id }
330
+ postingAd: { ...this.state.postingAd, images: images, id: response.id },
331
+ originalAd: { ...this.state.postingAd, images: images, id: response.id }
324
332
  })
325
333
  }
326
334
  }
@@ -390,7 +398,16 @@ export default class Posting extends React.Component {
390
398
  prevViews.shift();
391
399
 
392
400
  const view = this.state.prevViews[0];
393
- await this.setState({ prevViews: prevViews });
401
+ let originalAd = { ...this.state.postingAd };
402
+ if (this.state.originView === Views.EDIT_SELECTOR) {
403
+ originalAd = { ...this.state.originalAd };
404
+ }
405
+
406
+ await this.setState({
407
+ prevViews: prevViews,
408
+ postingAd: { ...originalAd },
409
+ originalAd: { ...originalAd }
410
+ });
394
411
  this._updateCurrentScreen(view);
395
412
  }
396
413
  }
@@ -412,7 +429,10 @@ export default class Posting extends React.Component {
412
429
  this.props.navigation.goBack();
413
430
  }
414
431
  } else {
415
- await this.setState({ postingAd: { ...this.state.postingAd, adId: response.id } });
432
+ await this.setState({
433
+ postingAd: { ...this.state.postingAd, adId: response.id },
434
+ originalAd: { ...this.state.postingAd, adId: response.id }
435
+ });
416
436
 
417
437
  this._goToPage(Views.PREVIEW, null, response);
418
438
  if (!showRating && this.props.showRatingPopup) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-posting",
3
- "version": "6.0.28",
3
+ "version": "7.0.0",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {
@@ -17,21 +17,21 @@
17
17
  },
18
18
  "homepage": "https://github.com/Mubawab/muba-posting#readme",
19
19
  "dependencies": {
20
- "@react-native-async-storage/async-storage": "~1.18.2",
21
- "muba-custom-scroll-view": "6",
22
- "muba-display-price": "6",
23
- "muba-font": "6",
24
- "muba-i18n": "6",
25
- "muba-input-select": "6",
26
- "muba-input-text": "6",
27
- "muba-loading-cursor": "6",
28
- "muba-map": "6",
29
- "muba-output-text": "6",
30
- "muba-phone-group": "6",
31
- "muba-picture": "6",
32
- "muba-payment-online": "6",
33
- "muba-popup-advice": "6",
34
- "muba-popup-permissions": "6",
35
- "muba-radio-button-group": "6"
20
+ "@react-native-async-storage/async-storage": "1.21.0",
21
+ "muba-custom-scroll-view": "7",
22
+ "muba-display-price": "7",
23
+ "muba-font": "7",
24
+ "muba-i18n": "7",
25
+ "muba-input-select": "7",
26
+ "muba-input-text": "7",
27
+ "muba-loading-cursor": "7",
28
+ "muba-map": "7",
29
+ "muba-output-text": "7",
30
+ "muba-phone-group": "7",
31
+ "muba-picture": "7",
32
+ "muba-payment-online": "7",
33
+ "muba-popup-advice": "7",
34
+ "muba-popup-permissions": "7",
35
+ "muba-radio-button-group": "7"
36
36
  }
37
37
  }