= ({
{options.map(({ label, value }: RadioSelectOption, index: number) => (
= ({
disabled={disabled}
onChange={() => setFieldValue(name, value)}
/>
- {label}
+ {label}
))}
diff --git a/packages/marketplace/src/components/ui/web-component-config-modal/__test__/__snapshots__/config-modal-inner.test.tsx.snap b/packages/marketplace/src/components/ui/web-component-config-modal/__test__/__snapshots__/config-modal-inner.test.tsx.snap
index 3f9e4a2af2..986b71f5c0 100644
--- a/packages/marketplace/src/components/ui/web-component-config-modal/__test__/__snapshots__/config-modal-inner.test.tsx.snap
+++ b/packages/marketplace/src/components/ui/web-component-config-modal/__test__/__snapshots__/config-modal-inner.test.tsx.snap
@@ -69,7 +69,8 @@ exports[`Config-modal-inner should WebComponentConfigModalInner match a snapshot
closeModal={[MockFunction]}
config={
Object {
- "subtext": "Please use the following form to configure your diary settings for your ‘Book a Viewing’ widget on your website",
+ "subtext": "Please use the following form to configure your diary settings for your
+ ‘Book a Viewing’ widget on your website",
"title": "Book a Viewing Configuration",
}
}
@@ -177,7 +178,8 @@ exports[`Config-modal-inner should WebComponentConfigModalInner match a snapshot
},
}
}
- subtext="Please use the following form to configure your diary settings for your ‘Book a Viewing’ widget on your website"
+ subtext="Please use the following form to configure your diary settings for your
+ ‘Book a Viewing’ widget on your website"
/>
}
>
@@ -249,10 +251,12 @@ exports[`Config-modal-inner should WebComponentConfigModalInner match a snapshot
},
}
}
- subtext="Please use the following form to configure your diary settings for your ‘Book a Viewing’ widget on your website"
+ subtext="Please use the following form to configure your diary settings for your
+ ‘Book a Viewing’ widget on your website"
>
- Please use the following form to configure your diary settings for your ‘Book a Viewing’ widget on your website
+ Please use the following form to configure your diary settings for your
+ ‘Book a Viewing’ widget on your website
{
expect(
mount(
-
+
,
),
).toMatchSnapshot()
diff --git a/packages/marketplace/src/components/ui/web-component-config-modal/config-modal.tsx b/packages/marketplace/src/components/ui/web-component-config-modal/config-modal.tsx
index 9b6784319b..d840214ba5 100644
--- a/packages/marketplace/src/components/ui/web-component-config-modal/config-modal.tsx
+++ b/packages/marketplace/src/components/ui/web-component-config-modal/config-modal.tsx
@@ -2,30 +2,29 @@ import * as React from 'react'
import { Modal } from '@reapit/elements'
import { WebComponentConfigModalInner } from './config-modal-inner'
-export const BOOK_VIEWING_CONSTANT = {
- title: 'Book a Viewing Configuration',
- subtext:
- 'Please use the following form to configure your diary settings for your ‘Book a Viewing’ widget on your website',
-}
-
-export const BOOK_VALUATION_CONSTANT = {
- title: 'Book a Valuation Configuration',
- subtext:
- 'Please use the following form to configure your diary settings for your ‘Book a Valuation’ widget on your website',
-}
-
export type WebComponentModalProps = {
type: 'BOOK_VIEWING' | 'BOOK_VALUATION'
afterClose: () => void
closeModal: () => void
}
-export const WebComponentModal = ({ type, afterClose, closeModal }: WebComponentModalProps) => {
- const config = type === 'BOOK_VIEWING' ? BOOK_VIEWING_CONSTANT : BOOK_VALUATION_CONSTANT
+export const WEB_COMPONENT_TYPES = {
+ BOOK_VALUATION: {
+ title: 'Book a Valuation Configuration',
+ subtext: `Please use the following form to configure your diary settings for your
+ ‘Book a Valuation’ widget on your website`,
+ },
+ BOOK_VIEWING: {
+ title: 'Book a Viewing Configuration',
+ subtext: `Please use the following form to configure your diary settings for your
+ ‘Book a Viewing’ widget on your website`,
+ },
+}
+export const WebComponentModal = ({ type, afterClose, closeModal }: WebComponentModalProps) => {
return (
-
+
)
}
diff --git a/packages/marketplace/src/core/index.tsx b/packages/marketplace/src/core/index.tsx
index 4d79a3c677..0b64c7801d 100644
--- a/packages/marketplace/src/core/index.tsx
+++ b/packages/marketplace/src/core/index.tsx
@@ -27,6 +27,7 @@ window.reapit = {
chatbotAppId: '',
marketplaceUrl: '',
platformApiUrl: '',
+ webComponentConfigApiUrl: '',
},
}
diff --git a/packages/marketplace/src/services/constants.ts b/packages/marketplace/src/services/constants.ts
index d8d8dee199..6d3313d958 100644
--- a/packages/marketplace/src/services/constants.ts
+++ b/packages/marketplace/src/services/constants.ts
@@ -18,4 +18,5 @@ export const URLS = {
trafficEventBilling: '/trafficevents/billing',
trafficEventStatistics: '/trafficevents/trafficStatistics',
negotiators: '/negotiators',
+ webComponentConfig: '/v1/web-components-config',
}
diff --git a/packages/marketplace/src/services/web-component.ts b/packages/marketplace/src/services/web-component.ts
index 2d383cb9be..6661941b85 100644
--- a/packages/marketplace/src/services/web-component.ts
+++ b/packages/marketplace/src/services/web-component.ts
@@ -1,6 +1,7 @@
import { fetcher } from '@reapit/elements'
import { generateHeader } from './utils'
import { logger } from 'logger'
+import { URLS } from './constants'
export interface FetchWebComponentConfigParams {
customerId: string
@@ -24,17 +25,14 @@ export type WebComponentConfigResult = {
negotiatorIds: string[]
} | null
-const API = '/dev/v1/web-components-config'
-
export const fetchWebComponentConfig = async (
params: FetchWebComponentConfigParams,
): Promise => {
- return sampleRespone() //SHOULD REMOVE WHEN API READY
try {
const { customerId } = params
const response = await fetcher({
- url: `${API}/${customerId}`,
- api: 'http://localhost:3000',
+ url: `${URLS.webComponentConfig}/${customerId}`,
+ api: window.reapit.config.webComponentConfigApiUrl,
method: 'GET',
headers: generateHeader(window.reapit.config.marketplaceApiKey),
})
@@ -46,12 +44,11 @@ export const fetchWebComponentConfig = async (
}
export const putWebComponentConfig = async (params: PutWebComponentConfigParams): Promise => {
- return sampleRespone() //SHOULD REMOVE WHEN API READY
try {
const { customerId = 'DXX', ...rest } = params
const response = await fetcher({
- url: `${API}/${customerId}`,
- api: 'http://localhost:3000',
+ url: `${URLS.webComponentConfig}/${customerId}`,
+ api: window.reapit.config.webComponentConfigApiUrl,
method: 'PATCH',
headers: generateHeader(window.reapit.config.marketplaceApiKey),
body: rest,
@@ -62,20 +59,3 @@ export const putWebComponentConfig = async (params: PutWebComponentConfigParams)
throw new Error(error)
}
}
-
-//SHOULD REMOVE WHEN API READY
-function sampleRespone(): Promise {
- return new Promise(res => {
- setTimeout(() => {
- const data = {
- appointmentLength: 15,
- appointmentTimeGap: 60,
- appointmentTypes: [{ value: 'value1', id: 'id1' }],
- customerId: 'DXX',
- daysOfWeek: ['1', '2', '3', '5', '6'],
- negotiatorIds: ['AACC', 'AAAN'],
- } as WebComponentConfigResult
- res(data)
- }, 1000)
- })
-}
diff --git a/packages/marketplace/src/tests/badges/badge-branches.svg b/packages/marketplace/src/tests/badges/badge-branches.svg
index 7a8f303567..27f77ced28 100644
--- a/packages/marketplace/src/tests/badges/badge-branches.svg
+++ b/packages/marketplace/src/tests/badges/badge-branches.svg
@@ -1 +1 @@
-Coverage:branches Coverage:branches 69.18% 69.18%
\ No newline at end of file
+Coverage:branches Coverage:branches 69.19% 69.19%
\ No newline at end of file
diff --git a/packages/marketplace/src/tests/badges/badge-lines.svg b/packages/marketplace/src/tests/badges/badge-lines.svg
index 173e33e04c..1eb02ff54c 100644
--- a/packages/marketplace/src/tests/badges/badge-lines.svg
+++ b/packages/marketplace/src/tests/badges/badge-lines.svg
@@ -1 +1 @@
-Coverage:lines Coverage:lines 90.05% 90.05%
\ No newline at end of file
+Coverage:lines Coverage:lines 90.04% 90.04%
\ No newline at end of file
diff --git a/packages/marketplace/src/types/global.d.ts b/packages/marketplace/src/types/global.d.ts
index 4b2d93e9f7..88792cb2c0 100644
--- a/packages/marketplace/src/types/global.d.ts
+++ b/packages/marketplace/src/types/global.d.ts
@@ -13,6 +13,7 @@ export type Config = {
chatbotAppId: string
marketplaceUrl: string
platformApiUrl: string
+ webComponentConfigApiUrl: string
}
declare global {