tf-checkout-react 1.6.6-beta.3 → 1.6.6-beta.31

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 (110) hide show
  1. package/README.md +61 -40
  2. package/dist/adapters/customFields.d.ts +1 -0
  3. package/dist/api/checkout.d.ts +1 -0
  4. package/dist/api/common.d.ts +1 -0
  5. package/dist/api/index.d.ts +1 -0
  6. package/dist/api/preRegistrationComplete.d.ts +1 -1
  7. package/dist/components/addonsContainer/AddonComponent.d.ts +5 -1
  8. package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +17 -0
  9. package/dist/components/addonsContainer/index.d.ts +5 -1
  10. package/dist/components/billing-info-container/index.d.ts +8 -1
  11. package/dist/components/billing-info-container/utils.d.ts +25 -1
  12. package/dist/components/common/DatePickerField.d.ts +7 -1
  13. package/dist/components/countdown/index.d.ts +1 -1
  14. package/dist/components/forgotPasswordModal/index.d.ts +2 -1
  15. package/dist/components/myTicketsContainer/index.d.ts +3 -2
  16. package/dist/components/orderDetailsContainer/index.d.ts +7 -1
  17. package/dist/components/paymentContainer/OrderDetails.d.ts +8 -0
  18. package/dist/components/paymentContainer/handlePayment.d.ts +15 -0
  19. package/dist/components/paymentContainer/index.d.ts +10 -5
  20. package/dist/components/preRegistration/FieldsSection.d.ts +7 -1
  21. package/dist/components/preRegistration/PreRegistrationComplete.d.ts +6 -0
  22. package/dist/components/preRegistration/constants.d.ts +2 -2
  23. package/dist/components/preRegistration/index.d.ts +6 -0
  24. package/dist/components/resetPasswordContainer/index.d.ts +2 -2
  25. package/dist/components/stripePayment/index.d.ts +18 -3
  26. package/dist/components/ticketsContainer/InfoIcon.d.ts +5 -0
  27. package/dist/components/ticketsContainer/TicketsSection.d.ts +3 -2
  28. package/dist/components/ticketsContainer/TimeSlotsSection.d.ts +25 -0
  29. package/dist/components/ticketsContainer/index.d.ts +18 -5
  30. package/dist/components/timerWidget/index.d.ts +2 -1
  31. package/dist/constants/index.d.ts +5 -0
  32. package/dist/index.d.ts +4 -1
  33. package/dist/tf-checkout-react.cjs.development.js +5196 -3599
  34. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  35. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  36. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  37. package/dist/tf-checkout-react.esm.js +5199 -3605
  38. package/dist/tf-checkout-react.esm.js.map +1 -1
  39. package/dist/tf-checkout-styles.css +1 -1
  40. package/dist/types/add_on.d.ts +1 -0
  41. package/dist/types/checkoutPageConfigs.d.ts +1 -1
  42. package/dist/types/order-data.d.ts +2 -1
  43. package/dist/utils/auth.d.ts +8 -0
  44. package/dist/utils/customFields.d.ts +11 -0
  45. package/dist/utils/getDomain.d.ts +1 -1
  46. package/dist/utils/index.d.ts +1 -1
  47. package/dist/utils/setConfigs.d.ts +1 -0
  48. package/package.json +3 -2
  49. package/src/adapters/customFields.ts +7 -1
  50. package/src/api/auth.ts +2 -1
  51. package/src/api/checkout.ts +8 -4
  52. package/src/api/common.ts +49 -2
  53. package/src/api/interceptors.ts +7 -23
  54. package/src/api/preRegistrationComplete.ts +1 -1
  55. package/src/api/publicRequest.ts +10 -0
  56. package/src/components/addonsContainer/AddonComponent.tsx +71 -11
  57. package/src/components/addonsContainer/SimpleAddonsContainer.tsx +388 -0
  58. package/src/components/addonsContainer/index.tsx +189 -58
  59. package/src/components/billing-info-container/index.tsx +704 -390
  60. package/src/components/billing-info-container/{utils.ts → utils.tsx} +119 -0
  61. package/src/components/common/CheckboxField/index.tsx +1 -1
  62. package/src/components/common/DatePickerField.tsx +25 -10
  63. package/src/components/common/SnackbarAlert.tsx +32 -34
  64. package/src/components/confirmationContainer/index.tsx +1 -1
  65. package/src/components/countdown/index.tsx +22 -22
  66. package/src/components/delegationsContainer/IssueComponent.tsx +2 -1
  67. package/src/components/forgotPasswordModal/index.tsx +44 -13
  68. package/src/components/loginForm/index.tsx +1 -1
  69. package/src/components/loginModal/index.tsx +2 -2
  70. package/src/components/loginModal/style.css +3 -1
  71. package/src/components/myTicketsContainer/index.tsx +13 -9
  72. package/src/components/orderDetailsContainer/index.tsx +188 -173
  73. package/src/components/paymentContainer/OrderDetails.tsx +170 -0
  74. package/src/components/paymentContainer/handlePayment.ts +86 -0
  75. package/src/components/paymentContainer/index.tsx +253 -226
  76. package/src/components/paymentContainer/style.css +113 -0
  77. package/src/components/preRegistration/FieldsSection.tsx +8 -0
  78. package/src/components/preRegistration/PreRegistrationComplete.tsx +128 -118
  79. package/src/components/preRegistration/PreRegistrationInformations.tsx +21 -15
  80. package/src/components/preRegistration/constants.tsx +10 -4
  81. package/src/components/preRegistration/index.tsx +194 -174
  82. package/src/components/registerForm/constants.tsx +3 -1
  83. package/src/components/registerForm/index.tsx +3 -3
  84. package/src/components/resetPasswordContainer/index.tsx +12 -13
  85. package/src/components/seatMapContainer/TicketsSection.tsx +2 -2
  86. package/src/components/stripePayment/index.tsx +129 -24
  87. package/src/components/ticketsContainer/InfoIcon.tsx +35 -0
  88. package/src/components/ticketsContainer/PromoCodeSection.tsx +34 -28
  89. package/src/components/ticketsContainer/TicketRow.tsx +1 -1
  90. package/src/components/ticketsContainer/TicketsSection.tsx +178 -52
  91. package/src/components/ticketsContainer/TimeSlotsSection.tsx +120 -0
  92. package/src/components/ticketsContainer/index.tsx +209 -99
  93. package/src/components/timerWidget/index.tsx +15 -3
  94. package/src/constants/index.ts +2 -0
  95. package/src/hoc/CustomFields/index.tsx +9 -1
  96. package/src/index.ts +7 -2
  97. package/src/types/add_on.ts +1 -0
  98. package/src/types/api/common.d.ts +27 -0
  99. package/src/types/api/orders.d.ts +19 -3
  100. package/src/types/api/payment.d.ts +5 -2
  101. package/src/types/api/preRegistrationComplete.d.ts +2 -2
  102. package/src/types/checkoutPageConfigs.ts +1 -1
  103. package/src/types/order-data.ts +2 -1
  104. package/src/types/pre-registration-complete.d.ts +6 -1
  105. package/src/utils/auth.ts +32 -0
  106. package/src/utils/cookies.ts +42 -11
  107. package/src/utils/customFields.ts +22 -0
  108. package/src/utils/getDomain.ts +10 -4
  109. package/src/utils/index.ts +1 -1
  110. package/src/utils/setConfigs.ts +3 -1
@@ -9,6 +9,7 @@ import {
9
9
  getFieldsKeys,
10
10
  getQueryVariable,
11
11
  } from '../../utils'
12
+ import { getAddOnDataWithCustomFields } from '../../utils/customFields'
12
13
 
13
14
  const withCustomFields = (Children: any) => (props: any) => {
14
15
  const {
@@ -27,18 +28,21 @@ const withCustomFields = (Children: any) => (props: any) => {
27
28
  const [customFieldsData, setCustomFieldsData] = useState({} as any)
28
29
  const [customFieldsOrderKeys, setCustomFieldsOrderKeys] = useState([] as any)
29
30
  const [customFieldsTicketHolderKeys, setCustomFieldsTicketHolderKeys] = useState([] as any)
31
+ const [customFieldsAddOnKeys, setCustomFieldsAddOnKeys] = useState([] as any)
30
32
 
31
33
  const getFields = async () => {
32
34
  try {
33
- const eventId = getQueryVariable('event_id') || ''
35
+ const eventId = getQueryVariable('event_id') || getQueryVariable("eventId") || ''
34
36
  const customFields = await getCustomFields(eventId)
35
37
 
36
38
  const orderFieldsKeys = getFieldsKeys(_get(customFields, 'orderFields', []))
37
39
  const ticketHoldersFieldsKeys = getFieldsKeys(_get(customFields, 'ticketsFields', []))
40
+ const addOnFieldsKeys = getFieldsKeys(_get(customFields, 'addOnFields', []))
38
41
 
39
42
  setCustomFieldsTicketHolderKeys(ticketHoldersFieldsKeys)
40
43
  setCustomFieldsOrderKeys(orderFieldsKeys)
41
44
  setCustomFieldsData(customFields)
45
+ setCustomFieldsAddOnKeys(addOnFieldsKeys)
42
46
 
43
47
  onGetCustomFieldsSuccess(customFields)
44
48
  } catch (e) {
@@ -59,6 +63,8 @@ const withCustomFields = (Children: any) => (props: any) => {
59
63
  ticketHoldersWithCustomFields,
60
64
  } = getDataWithCustomFields(data, ticketHoldersFields, customFieldsData)
61
65
 
66
+ const { addOnDataWithCustomFields } = getAddOnDataWithCustomFields(customFieldsData)
67
+
62
68
  if (lodaing) {
63
69
  return <CircularProgress size={50} />
64
70
  }
@@ -70,6 +76,8 @@ const withCustomFields = (Children: any) => (props: any) => {
70
76
  ticketHoldersFields={ticketHoldersWithCustomFields}
71
77
  customFieldsOrderKeys={customFieldsOrderKeys}
72
78
  customFieldsTicketHolderKeys={customFieldsTicketHolderKeys}
79
+ customFieldsAddOnKeys={customFieldsAddOnKeys}
80
+ addOnDataWithCustomFields={addOnDataWithCustomFields}
73
81
  />
74
82
  )
75
83
  }
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ export { currencyNormalizerCreator, createFixedFloatNormalizer } from './normali
6
6
  export { LoginModal } from './components/loginModal'
7
7
  export { MyTicketsContainer } from './components/myTicketsContainer'
8
8
  export { OrderDetailsContainer } from './components/orderDetailsContainer'
9
- export { setConfigs } from './utils/setConfigs'
9
+ export { DEFAULT_FEES_STYLE } from './constants/index'
10
10
  export { TicketResaleContainer } from './components'
11
11
  export { RedirectModal } from './components/common/RedirectModal'
12
12
  export { RsvpContainer } from './components/rsvpContainer'
@@ -22,4 +22,9 @@ export { DelegationsContainer } from './components/delegationsContainer'
22
22
  export { PoweredBy } from './components/common/PoweredBy'
23
23
  export { SeatMapContainer } from './components/seatMapContainer'
24
24
  export { IDVerification } from './components/idVerificationContainer'
25
- export { VERIFICATION_STATUSES } from './components/idVerificationContainer/constants'
25
+ export { VERIFICATION_STATUSES } from './components/idVerificationContainer/constants'
26
+
27
+ export { setConfigs } from './utils/setConfigs'
28
+ export { logoutUser } from './utils/auth'
29
+
30
+ export { OrderDetails } from './components/paymentContainer/OrderDetails'
@@ -3,5 +3,6 @@ export interface IAddOn {
3
3
  name: string;
4
4
  groupName: string | null;
5
5
  price: string;
6
+ cost: string;
6
7
  quantity: string | number;
7
8
  }
@@ -14,7 +14,17 @@ interface IEventResponseData {
14
14
  startDate: string;
15
15
  timezone: string;
16
16
  country: any;
17
+ timeslotSettings: ITimeslotSettings | undefined | null;
17
18
  }
19
+
20
+ interface ITimeslotSettings {
21
+ minPricePerDate: any;
22
+ showPrice: boolean;
23
+ groupsInfo: any;
24
+ availableDates: string[];
25
+ timeSlotDateInfo: any;
26
+ }
27
+
18
28
  interface IEventResponse extends IAxiosResponseData {
19
29
  data: {
20
30
  attributes: IEventResponseData;
@@ -62,6 +72,11 @@ interface ITicketsResponseData {
62
72
  interface ITicketsAdaptedResponseData extends ITicketsResponseData {
63
73
  tickets: ITicketData[];
64
74
  }
75
+
76
+ interface ITimeslotsAdaptedData extends ITicketsResponseData {
77
+ timeslots: {[key: string]: { [key: string]: ITicketData[] }};
78
+ }
79
+
65
80
  interface ITicketsResponse extends IAxiosResponseData {
66
81
  data: {
67
82
  attributes: ITicketsResponseData;
@@ -77,6 +92,14 @@ interface ITicketsAdaptedResponse extends IAxiosResponseData {
77
92
  };
78
93
  }
79
94
 
95
+ interface ITimeslotsAdaptedResponse extends IAxiosResponseData {
96
+ data: {
97
+ attributes: ITimeslotsAdaptedData;
98
+ relationships: Array<unknown>;
99
+ type: string;
100
+ };
101
+ }
102
+
80
103
  // Countries
81
104
  interface ICountriesAdaptedData {
82
105
  label: string;
@@ -117,3 +140,7 @@ interface IRSVPRequestData {
117
140
  email: string;
118
141
  }
119
142
  type IRSVPResponse = IAxiosResponseData
143
+
144
+ interface TimeSlotsResponse extends IAxiosResponseData {
145
+ data: string[];
146
+ }
@@ -57,18 +57,34 @@ interface IOrderAddOn {
57
57
  interface IOrderTicketAddOn {
58
58
  status: string;
59
59
  name: string;
60
+ groupName: string;
60
61
  }
61
62
 
62
- interface IOrderTicketData {
63
+ interface ITicketTypes {
64
+ add_ons?: IOrderTicketAddOn[];
63
65
  hash: string;
66
+ ticket_type: string;
67
+ holder_name: string;
68
+ status: string;
69
+ pdf_link: string;
70
+ is_sellable: boolean;
71
+ is_on_sale?: boolean;
72
+ event_name: string;
73
+ currency: string;
74
+ ticket_type_hash: string;
75
+ ticket_type_is_active?: boolean;
76
+ canSellTicket?: boolean;
77
+ retain_amount_on_sale: number | string;
78
+ ticketsTitle: string;
79
+ }
80
+
81
+ interface IOrderTicketData extends ITicketTypes {
64
82
  qrData: string;
65
83
  ticketType: string;
66
84
  description: string | null;
67
85
  descriptionPlain: string | null;
68
86
  holderName: string;
69
- status: string;
70
87
  eventName: string;
71
- currency: string;
72
88
  resaleFeeAmount: number;
73
89
  holderEmail: string;
74
90
  holderPhone: string | null;
@@ -18,6 +18,7 @@ interface IPaymentOrderDetails {
18
18
  id: string;
19
19
  name: string;
20
20
  price: number | string;
21
+ cost: number | string;
21
22
  quantity: number | string;
22
23
  guest_count?: string | number;
23
24
  }>;
@@ -25,6 +26,8 @@ interface IPaymentOrderDetails {
25
26
  pay_now?: string | number;
26
27
  guest_count?: string | number;
27
28
  debt?: number;
29
+ subtotal?: number | string;
30
+ fees?: number | string;
28
31
  }
29
32
 
30
33
  interface IPaymentMethodData {
@@ -34,7 +37,7 @@ interface IPaymentMethodData {
34
37
  stripe_payment_plan_enabled: boolean;
35
38
  stripe_payment_plan_configuration: any;
36
39
  stripeConnectedAccount: string;
37
- stripePublishableKey: string;
40
+ stripe_publishable_key: string;
38
41
  }
39
42
 
40
43
  interface IShippingBillingInfoData {
@@ -171,4 +174,4 @@ interface ICheckoutCompleteDataResponse extends IAxiosResponseData {
171
174
  relationships: Array<unknown>;
172
175
  type: string;
173
176
  };
174
- }
177
+ }
@@ -1,4 +1,4 @@
1
- interface IInfluancerData {
1
+ interface IInfluencerData {
2
2
  customer_id: string;
3
3
  data_capture: any;
4
4
  email: string;
@@ -25,7 +25,7 @@ interface IPrizeData {
25
25
 
26
26
  interface IInfluancersData {
27
27
  attributes: {
28
- influencers: IInfluancerData[];
28
+ influencers: IInfluencerData[];
29
29
  prizes: IPrizeData[];
30
30
  };
31
31
  relationships: Array<unknown>;
@@ -2,7 +2,7 @@ export interface ICheckoutPageConfigs {
2
2
  age_required: boolean;
3
3
  event_id: string;
4
4
  has_add_on: boolean;
5
- minimum_age: number | string | null;
5
+ minimum_age?: number | string | null;
6
6
  names_required: boolean;
7
7
  phone_required: boolean;
8
8
  skip_billing_page: boolean;
@@ -3,7 +3,7 @@ import { IAddOn } from './add_on'
3
3
  export interface IOrderData {
4
4
  id: string;
5
5
  product_name: string;
6
- ticketType: string;
6
+ ticketType: string | Array<any>;
7
7
  quantity: string | number;
8
8
  price: string | number;
9
9
  total: string | number;
@@ -11,4 +11,5 @@ export interface IOrderData {
11
11
  guest_count: string | number;
12
12
  pay_now: string | number;
13
13
  add_ons: IAddOn[];
14
+ cost: string | number;
14
15
  }
@@ -5,7 +5,7 @@ interface IPrewardsProps {
5
5
  }
6
6
 
7
7
  interface IInfluancersProps {
8
- data: Array<IInfluancerData>;
8
+ data: Array<IInfluencerData>;
9
9
  classNamePrefix: string;
10
10
  headerNode?: string | Node;
11
11
  }
@@ -28,6 +28,11 @@ interface IPreRegistrationInformationProps {
28
28
  onGetPreregistrationDataError?: () => void;
29
29
  influancersHeaderNode?: string | Node;
30
30
  prewardsHeaderNode?: string | Node;
31
+
32
+ themeOptions?: ThemeOptions & {
33
+ input?: CSSProperties;
34
+ checkbox?: CSSProperties;
35
+ };
31
36
  }
32
37
 
33
38
  interface IPreRegistrationCompleteProps extends IShareOptionsProps {
package/src/utils/auth.ts CHANGED
@@ -1,3 +1,9 @@
1
+ import { AxiosError } from 'axios'
2
+
3
+ import { logout } from '../api'
4
+ import { deleteCookieByName } from './cookies'
5
+ import { isBrowser } from './isBrowser'
6
+
1
7
  export const setLoggedUserData = (data: IProfileData) => ({
2
8
  id: data.id,
3
9
  first_name: data.firstName,
@@ -11,3 +17,29 @@ export const setLoggedUserData = (data: IProfileData) => ({
11
17
  state: data?.stateId || '',
12
18
  zip: data?.zipCode || '',
13
19
  })
20
+
21
+ interface LogoutUserParams {
22
+ onLogoutSuccess?: () => void;
23
+ onLogoutError?: (error: AxiosError) => void;
24
+ setIsLogged?: (isLogged: boolean) => void;
25
+ }
26
+
27
+ export const logoutUser = async ({
28
+ onLogoutSuccess,
29
+ onLogoutError,
30
+ setIsLogged,
31
+ }: LogoutUserParams) => {
32
+ try {
33
+ await logout()
34
+ onLogoutSuccess && onLogoutSuccess()
35
+ if (isBrowser) {
36
+ window.localStorage.removeItem('user_data')
37
+ setIsLogged && setIsLogged(false)
38
+ const event = new window.CustomEvent('tf-logout')
39
+ deleteCookieByName('X-TF-ECOMMERCE')
40
+ window.document.dispatchEvent(event)
41
+ }
42
+ } catch (e) {
43
+ onLogoutError && onLogoutError(e as AxiosError)
44
+ }
45
+ }
@@ -1,5 +1,7 @@
1
1
  import { getDomain } from './getDomain'
2
2
 
3
+ let generalDomain: string
4
+
3
5
  export function setCustomCookie(name: string, value: string, days = 5) {
4
6
  let expires = ''
5
7
  if (days) {
@@ -7,11 +9,25 @@ export function setCustomCookie(name: string, value: string, days = 5) {
7
9
  date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000)
8
10
  expires = '; expires=' + date.toUTCString()
9
11
  }
10
- if (typeof window !== 'undefined') {
11
- const domain = getDomain(window.location.hostname)
12
- document.cookie =
13
- name + '=' + (value || '') + expires + `; path=/; domain=${domain}`
12
+ if (typeof window === 'undefined') {
13
+ return
14
+ }
15
+
16
+ const { hostname } = window.location
17
+
18
+ if (generalDomain && generalDomain.endsWith(getDomain(hostname))) {
19
+ document.cookie = name + '=' + (value || '') + expires + `; path=/;domain=${generalDomain}`
20
+ return
14
21
  }
22
+
23
+ let previousDomain = undefined
24
+ let domain = undefined
25
+ do {
26
+ previousDomain = domain
27
+ domain = getDomain(hostname, undefined, previousDomain)
28
+ document.cookie = name + '=' + (value || '') + expires + `; path=/;domain=${domain}`
29
+ } while (getCookieByName(name) === '' && hostname !== domain)
30
+ generalDomain = domain
15
31
  }
16
32
 
17
33
  export function getCookieByName(cname: string) {
@@ -31,12 +47,27 @@ export function getCookieByName(cname: string) {
31
47
  }
32
48
 
33
49
  export function deleteCookieByName(name: string) {
34
- if (typeof window !== 'undefined') {
35
- const domain = getDomain(window.location.hostname)
36
- document.cookie =
37
- name +
38
- '=; Path=/' +
39
- `; domain=${domain}` +
40
- '; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
50
+ if (getCookieByName(name) === '') {
51
+ return
41
52
  }
53
+
54
+ if (typeof window === 'undefined') {
55
+ return
56
+ }
57
+
58
+ const { hostname } = window.location
59
+
60
+ if (generalDomain && generalDomain.endsWith(getDomain(hostname))) {
61
+ document.cookie = name + `=; Path=/;domain=${generalDomain}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`
62
+ return
63
+ }
64
+
65
+ let previousDomain = undefined
66
+ let domain = undefined
67
+ do {
68
+ previousDomain = domain
69
+ domain = getDomain(hostname, undefined, previousDomain)
70
+ document.cookie = name + `=; Path=/;domain=${domain}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`
71
+ } while (getCookieByName(name) !== '' && hostname !== domain)
72
+ generalDomain = domain
42
73
  }
@@ -54,5 +54,27 @@ export const getDataWithCustomFields = (
54
54
  return { dataWithCustomFields, ticketHoldersWithCustomFields }
55
55
  }
56
56
 
57
+ export const getAddOnDataWithCustomFields = (customFields: any) => {
58
+ // Custom Fields are not specified case
59
+ if (_isEmpty(customFields)) {
60
+ return { addOnDataWithCustomFields: [] }
61
+ }
62
+
63
+ // Add Custom Fields for Order
64
+ const orderWithCustomFields = [
65
+ {
66
+ id: 1,
67
+ groupClassname: 'billing-info-container__customFields',
68
+ groupItems: [...customFields.addOnFields],
69
+ },
70
+ ]
71
+
72
+ const addOnDataWithCustomFields = {
73
+ fields: orderWithCustomFields,
74
+ }
75
+
76
+ return { addOnDataWithCustomFields }
77
+ }
78
+
57
79
  export const getFieldsKeys = (customFields: any) =>
58
80
  _map(customFields, field => field.name)
@@ -1,10 +1,16 @@
1
- export function getDomain(url: string, subdomain?: string): string {
1
+ export function getDomain(url: string, subdomain?: string, publicSuffix?: string): string {
2
2
  let updatedUrl: any = url.replace(/(https?:\/\/)?(www.)?/i, '')
3
3
 
4
4
  if (!subdomain) {
5
- updatedUrl = updatedUrl.split('.')
6
-
7
- updatedUrl = updatedUrl.slice(updatedUrl.length - 2).join('.')
5
+ if (publicSuffix) {
6
+ const updatedPublicSuffix = publicSuffix.startsWith('.') ? publicSuffix : '.' + publicSuffix
7
+ updatedUrl = url.replace(updatedPublicSuffix, '').split('.')
8
+ updatedUrl = updatedUrl.length > 0 ? updatedUrl[updatedUrl.length - 1] : ''
9
+ updatedUrl += updatedPublicSuffix
10
+ } else {
11
+ updatedUrl = updatedUrl.split(".")
12
+ updatedUrl = updatedUrl.slice(updatedUrl.length - 2).join(".")
13
+ }
8
14
  }
9
15
 
10
16
  if (updatedUrl.indexOf('/') !== -1) {
@@ -9,7 +9,7 @@ export { createMarkup } from './createMarkup'
9
9
  export { replaceVarInString } from './replaceVarInString'
10
10
  export { isBrowser } from './isBrowser'
11
11
  export { getFormInitialValues } from './form'
12
- export { setLoggedUserData } from './auth'
12
+ export { setLoggedUserData, logoutUser } from './auth'
13
13
  export { getDataWithCustomFields, getFieldsKeys } from './customFields'
14
14
  export { createElementFromHTML } from './htmlNodeFromString'
15
15
  export { isJson } from './jsonUtils'
@@ -1,6 +1,7 @@
1
1
  import _forEach from 'lodash/forEach'
2
2
 
3
3
  import { publicRequest } from '../api/publicRequest'
4
+ import { DEFAULT_FEES_STYLE } from '../constants'
4
5
 
5
6
  export interface IConfigs {
6
7
  BASE_URL: string;
@@ -8,10 +9,11 @@ export interface IConfigs {
8
9
  CLIENT_SECRET: string;
9
10
  STRIPE_PUBLISHABLE_KEY: string;
10
11
  X_SOURCE_ORIGIN: string;
12
+ FEES_STYLE: string;
11
13
  [key: string]: string | number;
12
14
  }
13
15
 
14
- export const CONFIGS: IConfigs = {} as IConfigs
16
+ export const CONFIGS: IConfigs = { FEES_STYLE: DEFAULT_FEES_STYLE } as IConfigs
15
17
 
16
18
  export const setConfigs = (configs: IConfigs) => {
17
19
  _forEach(configs, (value, key) => {