ordering-ui-external 13.0.3 → 13.0.5

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 (47) hide show
  1. package/_bundles/0.ordering-ui.48d6f3f7598e282809bf.js +1 -0
  2. package/_bundles/{1.ordering-ui.5617cfdb5c1f6e9afbbf.js → 1.ordering-ui.48d6f3f7598e282809bf.js} +1 -1
  3. package/_bundles/{2.ordering-ui.5617cfdb5c1f6e9afbbf.js → 2.ordering-ui.48d6f3f7598e282809bf.js} +1 -1
  4. package/_bundles/{4.ordering-ui.5617cfdb5c1f6e9afbbf.js → 4.ordering-ui.48d6f3f7598e282809bf.js} +1 -1
  5. package/_bundles/{5.ordering-ui.5617cfdb5c1f6e9afbbf.js → 5.ordering-ui.48d6f3f7598e282809bf.js} +1 -1
  6. package/_bundles/{6.ordering-ui.5617cfdb5c1f6e9afbbf.js → 6.ordering-ui.48d6f3f7598e282809bf.js} +1 -1
  7. package/_bundles/{7.ordering-ui.5617cfdb5c1f6e9afbbf.js → 7.ordering-ui.48d6f3f7598e282809bf.js} +2 -2
  8. package/_bundles/{8.ordering-ui.5617cfdb5c1f6e9afbbf.js → 8.ordering-ui.48d6f3f7598e282809bf.js} +1 -1
  9. package/_bundles/{9.ordering-ui.5617cfdb5c1f6e9afbbf.js → 9.ordering-ui.48d6f3f7598e282809bf.js} +1 -1
  10. package/_bundles/ordering-ui.48d6f3f7598e282809bf.js +2 -0
  11. package/_bundles/{ordering-ui.5617cfdb5c1f6e9afbbf.js.LICENSE.txt → ordering-ui.48d6f3f7598e282809bf.js.LICENSE.txt} +0 -2
  12. package/_modules/themes/callcenterOriginal/src/components/Orders/OrderLogisticInformation/index.js +9 -0
  13. package/_modules/themes/callcenterOriginal/src/components/Orders/OrderStatusSubFilter/index.js +9 -0
  14. package/_modules/themes/callcenterOriginal/src/components/Orders/OrderStatusTypeSelector/index.js +88 -19
  15. package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersCards/index.js +9 -0
  16. package/_modules/themes/five/src/components/Messages/index.js +7 -1
  17. package/_modules/themes/five/src/components/MessagesListing/index.js +4 -3
  18. package/_modules/themes/five/src/components/MomentControl/index.js +41 -2
  19. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +2 -1
  20. package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +6 -0
  21. package/_modules/themes/five/src/components/OrderDetails/OrderPreferencesSections.js +2 -1
  22. package/_modules/themes/five/src/components/OrderDetails/index.js +11 -8
  23. package/_modules/themes/five/src/components/OrderDetails/layouts/Kiosk/index.js +23 -8
  24. package/_modules/themes/five/src/components/OrderDetails/styles.js +1 -1
  25. package/_modules/themes/five/src/components/OrderProgress/index.js +4 -3
  26. package/_modules/themes/five/src/components/OrdersOption/index.js +1 -1
  27. package/_modules/utils/index.js +31 -16
  28. package/package.json +2 -2
  29. package/src/themes/callcenterOriginal/src/components/Orders/OrderLogisticInformation/index.js +4 -1
  30. package/src/themes/callcenterOriginal/src/components/Orders/OrderStatusSubFilter/index.js +4 -1
  31. package/src/themes/callcenterOriginal/src/components/Orders/OrderStatusTypeSelector/index.js +91 -19
  32. package/src/themes/callcenterOriginal/src/components/Orders/OrdersCards/index.js +4 -1
  33. package/src/themes/five/src/components/Messages/index.js +7 -1
  34. package/src/themes/five/src/components/MessagesListing/index.js +4 -3
  35. package/src/themes/five/src/components/MomentControl/index.js +35 -6
  36. package/src/themes/five/src/components/OrderDetails/OrderEta.js +2 -1
  37. package/src/themes/five/src/components/OrderDetails/OrderHistory.js +6 -0
  38. package/src/themes/five/src/components/OrderDetails/OrderPreferencesSections.js +2 -1
  39. package/src/themes/five/src/components/OrderDetails/index.js +21 -12
  40. package/src/themes/five/src/components/OrderDetails/layouts/Kiosk/index.js +4 -1
  41. package/src/themes/five/src/components/OrderDetails/styles.js +0 -1
  42. package/src/themes/five/src/components/OrderProgress/index.js +4 -3
  43. package/src/themes/five/src/components/OrdersOption/index.js +2 -2
  44. package/src/utils/index.js +4 -1
  45. package/_bundles/0.ordering-ui.5617cfdb5c1f6e9afbbf.js +0 -1
  46. package/_bundles/ordering-ui.5617cfdb5c1f6e9afbbf.js +0 -2
  47. /package/_bundles/{7.ordering-ui.5617cfdb5c1f6e9afbbf.js.LICENSE.txt → 7.ordering-ui.48d6f3f7598e282809bf.js.LICENSE.txt} +0 -0
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useEffect, useMemo } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
3
  import {
4
- useLanguage,
5
4
  OrderDetails as OrderDetailsController,
5
+ useLanguage,
6
6
  useEvent,
7
7
  useUtils,
8
8
  useConfig,
@@ -14,7 +14,6 @@ import {
14
14
  import RiUser2Fill from '@meronex/icons/ri/RiUser2Fill'
15
15
  import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
16
16
  import ExclamationTriangleIcon from '@meronex/icons/bs/BsExclamationTriangle'
17
-
18
17
  import { Button } from '../../styles/Buttons'
19
18
  import { NotFoundSource } from '../NotFoundSource'
20
19
 
@@ -129,14 +128,15 @@ const OrderDetailsUI = (props) => {
129
128
  const acceptedStatus = [1, 2, 5, 6, 10, 11, 12, 15]
130
129
  const completedStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
131
130
  const placeSpotTypes = [3, 4, 5]
132
- const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
131
+ const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
133
132
  const preorderStatus = [0, 13]
134
133
  const googleMapsApiKey = configs?.google_maps_api_key?.value
135
134
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
136
135
  const changeIdToExternalId = configs?.change_order_id?.value === '1'
137
136
  const cateringTypes = [7, 8]
137
+ const deliveryTypes = [1, 7]
138
138
 
139
- const hideOrderActions = order?.delivery_type === 1
139
+ const hideOrderActions = deliveryTypes?.includes(order?.delivery_type)
140
140
  const isGiftCardOrder = !order?.business_id
141
141
 
142
142
  const isOriginalLayout = theme?.confirmation?.components?.layout?.type === 'original'
@@ -158,7 +158,7 @@ const OrderDetailsUI = (props) => {
158
158
  const hideCustomerEmail = theme?.confirmation?.components?.customer?.components?.email?.hidden
159
159
  const hideCustomerPhoto = theme?.confirmation?.components?.customer?.components?.photo?.hidden
160
160
 
161
- const validTrackingStatus = [9, 19, 23]
161
+ const validTrackingStatus = [9, 19, 23, 26]
162
162
  const mapConfigs = { zoom: 15 }
163
163
 
164
164
  const handleGoToPage = (data) => {
@@ -435,13 +435,22 @@ const OrderDetailsUI = (props) => {
435
435
  </p>
436
436
  )}
437
437
  {!hideDeliveryDate && (
438
- <p className='date'>
439
- {activeStatus.includes(order?.status) ? (
440
- <OrderEta order={order} outputFormat={`YYYY-MM-DD ${configs?.general_hour_format?.value}`} />
441
- ) : (
442
- parseDate(order?.reporting_data?.at[`status:${order.status}`], { outputFormat: `YYYY-MM-DD ${configs?.general_hour_format?.value}` })
438
+ <>
439
+ {cateringTypes.includes(order?.delivery_type) && (
440
+ <p className='date'>
441
+ {t('CREATED_AT', 'Created at')}: {parseDate(order?.created_at)}
442
+ </p>
443
443
  )}
444
- </p>
444
+ <p className='date'>
445
+ {activeStatus.includes(order?.status) ? (
446
+ <>
447
+ {cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} <OrderEta order={order} outputFormat={`YYYY-MM-DD ${configs?.general_hour_format?.value}`} />
448
+ </>
449
+ ) : (
450
+ parseDate(order?.reporting_data?.at[`status:${order.status}`], { outputFormat: `YYYY-MM-DD ${configs?.general_hour_format?.value}` })
451
+ )}
452
+ </p>
453
+ </>
445
454
  )}
446
455
  {(acceptedStatus.includes(parseInt(order?.status, 10)) ||
447
456
  !isOriginalLayout
@@ -679,7 +688,7 @@ const OrderDetailsUI = (props) => {
679
688
  }
680
689
  </>
681
690
  )}
682
- {(order?.delivery_type === 1 || order?.comment) && !isGiftCardOrder && (
691
+ {(deliveryTypes?.includes(order?.delivery_type) || order?.comment) && !isGiftCardOrder && (
683
692
  <OrderPreferences>
684
693
  <OrderPreferencesSection
685
694
  order={order}
@@ -115,7 +115,10 @@ const OrderDetailsUI = (props) => {
115
115
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
116
116
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
117
117
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
118
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
118
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 },
119
+ { key: 24, value: t('ORDER_DRIVER_WAITING_FOR_ORDER', theme?.defaultLanguages?.ORDER_DRIVER_WAITING_FOR_ORDER || 'Driver waiting for order'), slug: 'ORDER_DRIVER_WAITING_FOR_ORDER', percentage: 25 },
120
+ { key: 25, value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', theme?.defaultLanguages?.ORDER_ACCEPTED_BY_DRIVER_COMPANY || 'Accepted by driver company'), slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY', percentage: 25 },
121
+ { key: 26, value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ARRIVED_CUSTOMER || 'Driver arrived to customer'), slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER', percentage: 80 }
119
122
  ]
120
123
 
121
124
  const objectStatus = orderStatus.find((o) => o.key === status)
@@ -183,7 +183,6 @@ export const OrderInfo = styled.div`
183
183
  }
184
184
  .date {
185
185
  margin-bottom: 6px;
186
- text-transform: uppercase;
187
186
  }
188
187
  .types {
189
188
  margin-bottom: 6px;
@@ -37,7 +37,8 @@ const OrderProgressUI = (props) => {
37
37
  const theme = useTheme()
38
38
  const [events] = useEvent()
39
39
  const [lastOrder, setLastOrder] = useState(null)
40
- const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
40
+ const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
41
+ const deliveryTypes = [1, 7]
41
42
 
42
43
  const isChew = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
43
44
 
@@ -108,7 +109,7 @@ const OrderProgressUI = (props) => {
108
109
  <ProgressTextWrapper>
109
110
  <StatusWrapper>{progressBarObjt(lastOrder?.status)?.value}</StatusWrapper>
110
111
  <TimeWrapper>
111
- <span>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}:&nbsp;</span>
112
+ <span>{deliveryTypes?.includes(lastOrder?.delivery_type) ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}:&nbsp;</span>
112
113
  <span>
113
114
  {lastOrder?.delivery_datetime_utc
114
115
  ? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: configs?.general_hour_format?.value || 'HH:mm' })
@@ -137,7 +138,7 @@ export const OrderProgress = (props) => {
137
138
  const orderProgressProps = {
138
139
  ...props,
139
140
  UIComponent: OrderProgressUI,
140
- orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
141
+ orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
141
142
  useDefualtSessionManager: true,
142
143
  noGiftCardOrders: true,
143
144
  propsToFetchBusiness,
@@ -369,9 +369,9 @@ export const OrdersOption = (props) => {
369
369
  UIComponent: OrdersOptionUI,
370
370
  noGiftCardOrders: true,
371
371
  orderStatus: getAllOrders
372
- ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
372
+ ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
373
373
  : props.activeOrders
374
- ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
374
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
375
375
  : (props.pastOrders ? [1, 2, 5, 6, 10, 11, 12, 15, 16, 17] : [13]),
376
376
  useDefualtSessionManager: true,
377
377
  paginationSettings: {
@@ -651,7 +651,10 @@ export const getOrderStatus = (s) => {
651
651
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
652
652
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 90 },
653
653
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 30 },
654
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 80 }
654
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 80 },
655
+ { key: 24, value: t('ORDER_DRIVER_WAITING_FOR_ORDER', theme?.defaultLanguages?.ORDER_DRIVER_WAITING_FOR_ORDER || 'Driver waiting for order'), slug: 'ORDER_DRIVER_WAITING_FOR_ORDER', percentage: 25 },
656
+ { key: 25, value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', theme?.defaultLanguages?.ORDER_ACCEPTED_BY_DRIVER_COMPANY || 'Accepted by driver company'), slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY', percentage: 25 },
657
+ { key: 26, value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ARRIVED_CUSTOMER || 'Driver arrived to customer'), slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER', percentage: 80 }
655
658
  ]
656
659
  const objectStatus = orderStatus.find((o) => o.key === status)
657
660
  return objectStatus && objectStatus
@@ -1 +0,0 @@
1
- (window.webpackJsonpOrderingUI=window.webpackJsonpOrderingUI||[]).push([[0],{730:function(t,n,e){"use strict";function i(t,n){var e,i;return"boolean"==typeof(null==n?void 0:n.enabled)?n.enabled:null===(i=null===(e=null==t?void 0:t.__default)||void 0===e?void 0:e.enabled)||void 0===i||i}e.d(n,"a",(function(){return i}))},834:function(t,n,e){"use strict";e.r(n),e.d(n,"LegacyDestination",(function(){return S})),e.d(n,"ajsDestinations",(function(){return k}));var i=e(4),r=e(80),o=e(66),a=e(46),s=e(60),c=e(141),u=e(135),d=e(730),l=e(258),h=e(264),v=e(243),f=e(99),b=e(259),p=e(122),g=e(154);function y(t){return t.toLowerCase().replace(".","").replace(/\s+/g,"-")}function O(t,n){return void 0===n&&(n=!1),n?btoa(t).replace(/=/g,""):void 0}function j(t,n,e,r){return Object(i.b)(this,void 0,void 0,(function(){var o,a,s,c,u,d;return Object(i.d)(this,(function(l){switch(l.label){case 0:o=y(n),a=O(o,r),s=Object(p.b)(),c="".concat(s,"/integrations/").concat(null!=a?a:o,"/").concat(e,"/").concat(null!=a?a:o,".dynamic.js.gz"),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Object(g.a)(c)];case 2:return l.sent(),function(t,n,e){var r,o;try{var a=(null!==(o=null===(r=null===window||void 0===window?void 0:window.performance)||void 0===r?void 0:r.getEntriesByName(t,"resource"))&&void 0!==o?o:[])[0];a&&n.stats.gauge("legacy_destination_time",Math.round(a.duration),Object(i.f)([e],a.duration<100?["cached"]:[],!0))}catch(t){}}(c,t,n),[3,4];case 3:throw u=l.sent(),t.stats.gauge("legacy_destination_time",-1,["plugin:".concat(n),"failed"]),u;case 4:return d=window["".concat(o,"Deps")],[4,Promise.all(d.map((function(t){return Object(g.a)(s+t+".gz")})))];case 5:return l.sent(),window["".concat(o,"Loader")](),[2,window["".concat(o,"Integration")]]}}))}))}var m=e(81),w=function(t,n){var e,i=n.type,r=n.bundlingStatus,o=n.versionSettings,a="unbundled"!==r&&("browser"===i||(null===(e=null==o?void 0:o.componentTypes)||void 0===e?void 0:e.includes("browser")));return!t.startsWith("Segment")&&"Iterable"!==t&&a},_=function(t,n){var e=!1===n.All&&void 0===n[t];return!1===n[t]||e},I=e(126);function z(t,n){return Object(i.b)(this,void 0,void 0,(function(){var e,r=this;return Object(i.d)(this,(function(s){switch(s.label){case 0:return e=[],Object(o.a)()?[2,n]:[4,Object(h.a)((function(){return n.length>0&&Object(o.b)()}),(function(){return Object(i.b)(r,void 0,void 0,(function(){var r,o;return Object(i.d)(this,(function(i){switch(i.label){case 0:return(r=n.pop())?[4,Object(u.a)(r,t)]:[2];case 1:return o=i.sent(),o instanceof a.a||e.push(r),[2]}}))}))}))];case 1:return s.sent(),e.map((function(t){return n.pushWithBackoff(t)})),[2,n]}}))}))}var S=function(){function t(t,n,e,r,o,a){void 0===r&&(r={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=t,this.version=n,this.settings=Object(i.a)({},r),this.disableAutoISOConversion=o.disableAutoISOConversion||!1,this.integrationSource=a,this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=o,this.buffer=o.disableClientPersistence?new v.b(4,[]):new f.a(4,"".concat(e,":dest-").concat(t)),this.scheduleFlush()}return t.prototype.isLoaded=function(){return this._ready},t.prototype.ready=function(){var t;return null!==(t=this.onReady)&&void 0!==t?t:Promise.resolve()},t.prototype.load=function(t,n){var e;return Object(i.b)(this,void 0,void 0,(function(){var r,o,a=this;return Object(i.d)(this,(function(i){switch(i.label){case 0:return this._ready||void 0!==this.onReady?[2]:null===(e=this.integrationSource)||void 0===e?[3,1]:(o=e,[3,3]);case 1:return[4,j(t,this.name,this.version,this.options.obfuscate)];case 2:o=i.sent(),i.label=3;case 3:r=o,this.integration=function(t,n,e){var i;"Integration"in t?(t({user:function(){return e.user()},addIntegration:function(){}}),i=t.Integration):i=t;var r=new i(n);return r.analytics=e,r}(r,this.settings,n),this.onReady=new Promise((function(t){a.integration.once("ready",(function(){a._ready=!0,t(!0)}))})),this.onInitialize=new Promise((function(t){a.integration.on("initialize",(function(){a._initialized=!0,t(!0)}))}));try{Object(I.a)(t,{integrationName:this.name,methodName:"initialize",type:"classic"}),this.integration.initialize()}catch(n){throw Object(I.a)(t,{integrationName:this.name,methodName:"initialize",type:"classic",didError:!0}),n}return[2]}}))}))},t.prototype.unload=function(t,n){return function(t,n,e){return Object(i.b)(this,void 0,void 0,(function(){var r,o,a,s;return Object(i.d)(this,(function(i){return r=Object(p.b)(),o=y(t),a=O(t,e),s="".concat(r,"/integrations/").concat(null!=a?a:o,"/").concat(n,"/").concat(null!=a?a:o,".dynamic.js.gz"),[2,Object(g.b)(s)]}))}))}(this.name,this.version,this.options.obfuscate)},t.prototype.addMiddleware=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.middleware=(t=this.middleware).concat.apply(t,n)},t.prototype.shouldBuffer=function(t){return"page"!==t.event.type&&(Object(o.a)()||!1===this._ready||!1===this._initialized)},t.prototype.send=function(t,n,e){var r,o;return Object(i.b)(this,void 0,void 0,(function(){var a,c,u,l,h,v;return Object(i.d)(this,(function(f){switch(f.label){case 0:if(this.shouldBuffer(t))return this.buffer.push(t),this.scheduleFlush(),[2,t];if(a=null===(o=null===(r=this.options)||void 0===r?void 0:r.plan)||void 0===o?void 0:o.track,c=t.event.event,a&&c&&"Segment.io"!==this.name){if(u=a[c],!Object(d.a)(a,u))return t.updateEvent("integrations",Object(i.a)(Object(i.a)({},t.event.integrations),{All:!1,"Segment.io":!0})),t.cancel(new s.a({retry:!1,reason:"Event ".concat(c," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,t];if(t.updateEvent("integrations",Object(i.a)(Object(i.a)({},t.event.integrations),null==u?void 0:u.integrations)),(null==u?void 0:u.enabled)&&!1===(null==u?void 0:u.integrations[this.name]))return t.cancel(new s.a({retry:!1,reason:"Event ".concat(c," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,t]}return[4,Object(b.applyDestinationMiddleware)(this.name,t.event,this.middleware)];case 1:if(null===(l=f.sent()))return[2,t];h=new n(l,{traverse:!this.disableAutoISOConversion}),Object(I.a)(t,{integrationName:this.name,methodName:e,type:"classic"}),f.label=2;case 2:return f.trys.push([2,5,,6]),this.integration?[4,this.integration.invoke.call(this.integration,e,h)]:[3,4];case 3:f.sent(),f.label=4;case 4:return[3,6];case 5:throw v=f.sent(),Object(I.a)(t,{integrationName:this.name,methodName:e,type:"classic",didError:!0}),v;case 6:return[2,t]}}))}))},t.prototype.track=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Track,"track")]}))}))},t.prototype.page=function(t){var n;return Object(i.b)(this,void 0,void 0,(function(){var e=this;return Object(i.d)(this,(function(i){return(null===(n=this.integration)||void 0===n?void 0:n._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return e.send(t,r.Page,"page")}))]}))}))},t.prototype.identify=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Identify,"identify")]}))}))},t.prototype.alias=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Alias,"alias")]}))}))},t.prototype.group=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Group,"group")]}))}))},t.prototype.scheduleFlush=function(){var t=this;this.flushing||setTimeout((function(){return Object(i.b)(t,void 0,void 0,(function(){var t;return Object(i.d)(this,(function(n){switch(n.label){case 0:return this.flushing=!0,t=this,[4,z(this,this.buffer)];case 1:return t.buffer=n.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},t}();function k(t,n,e,r,o,a){var s,u;if(void 0===e&&(e={}),void 0===r&&(r={}),Object(c.b)())return[];n.plan&&((r=null!=r?r:{}).plan=n.plan);var d=null!==(u=null===(s=n.middlewareSettings)||void 0===s?void 0:s.routingRules)&&void 0!==u?u:[],h=n.integrations,v=r.integrations,f=Object(l.a)(n,null!=r?r:{}),b=null==a?void 0:a.reduce((function(t,n){var e;return Object(i.a)(Object(i.a)({},t),((e={})[function(t){return("Integration"in t?t.Integration:t).prototype.name}(n)]=n,e))}),{}),p=new Set(Object(i.f)(Object(i.f)([],Object.keys(h).filter((function(t){return w(t,h[t])})),!0),Object.keys(b||{}).filter((function(t){return Object(m.d)(h[t])||Object(m.d)(null==v?void 0:v[t])})),!0));return Array.from(p).filter((function(t){return!_(t,e)})).map((function(n){var e=function(t){var n,e,i,r;return null!==(r=null!==(e=null===(n=null==t?void 0:t.versionSettings)||void 0===n?void 0:n.override)&&void 0!==e?e:null===(i=null==t?void 0:t.versionSettings)||void 0===i?void 0:i.version)&&void 0!==r?r:"latest"}(h[n]),i=new S(n,e,t,f[n],r,null==b?void 0:b[n]);return d.filter((function(t){return t.destinationName===n})).length>0&&o&&i.addMiddleware(o),i}))}}}]);