Skip to content

Commit

Permalink
fix: app market go live fixes (#8001)
Browse files Browse the repository at this point in the history
* fix: app market go live fixes

* fix: app market go live fixes
  • Loading branch information
willmcvay authored Oct 26, 2022
1 parent c13ec22 commit 40c8d07
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export const AppBrowseUpsertModal: FC<AppBrowseUpsertModalDefaultProps> = ({
closeModal,
upsertItem,
}) => {
console.log(defaultValues?.live?.timeFrom)
const {
register,
handleSubmit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,20 @@ export const AppBrowseUpsert: FC<{}> = () => {
/>
))
)}
<AppBrowseUpsertModal
modalIsOpen={typeof configType !== 'undefined'}
defaultValues={
{
configType: configType as AppsBrowseConfigEnum,
index: items.filter((item) => item.configType === configType).length,
} as AppsBrowseConfigItemInterface
}
closeModal={closeModal}
connectSession={connectSession as ReapitConnectSession}
upsertItem={upsertItem}
/>
{configType && (
<AppBrowseUpsertModal
modalIsOpen={typeof configType !== 'undefined'}
defaultValues={
{
configType: configType as AppsBrowseConfigEnum,
index: items.filter((item) => item.configType === configType).length,
} as AppsBrowseConfigItemInterface
}
closeModal={closeModal}
connectSession={connectSession as ReapitConnectSession}
upsertItem={upsertItem}
/>
)}
{selectedItem && (
<AppBrowseUpsertModal
modalIsOpen={typeof selectedItem !== 'undefined'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl1"
placeholder="Video embed url instructing users"
placeholder="Video embed url instructing users (YouTube or Vimeo)"
type="text"
/>
<label
Expand All @@ -213,7 +213,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl2"
placeholder="Video embed url marketing your app"
placeholder="Video embed url marketing your app (YouTube or Vimeo)"
type="text"
/>
<label
Expand Down Expand Up @@ -642,7 +642,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl1"
placeholder="Video embed url instructing users"
placeholder="Video embed url instructing users (YouTube or Vimeo)"
type="text"
/>
<label
Expand All @@ -663,7 +663,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl2"
placeholder="Video embed url marketing your app"
placeholder="Video embed url marketing your app (YouTube or Vimeo)"
type="text"
/>
<label
Expand Down Expand Up @@ -1269,7 +1269,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl1"
placeholder="Video embed url instructing users"
placeholder="Video embed url instructing users (YouTube or Vimeo)"
type="text"
/>
<label
Expand All @@ -1290,7 +1290,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl2"
placeholder="Video embed url marketing your app"
placeholder="Video embed url marketing your app (YouTube or Vimeo)"
type="text"
/>
<label
Expand Down Expand Up @@ -1938,7 +1938,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl1"
placeholder="Video embed url instructing users"
placeholder="Video embed url instructing users (YouTube or Vimeo)"
type="text"
/>
<label
Expand All @@ -1959,7 +1959,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl2"
placeholder="Video embed url marketing your app"
placeholder="Video embed url marketing your app (YouTube or Vimeo)"
type="text"
/>
<label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl1"
placeholder="Video embed url instructing users"
placeholder="Video embed url instructing users (YouTube or Vimeo)"
type="text"
/>
<label
Expand All @@ -388,7 +388,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl2"
placeholder="Video embed url marketing your app"
placeholder="Video embed url marketing your app (YouTube or Vimeo)"
type="text"
/>
<label
Expand Down Expand Up @@ -902,7 +902,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl1"
placeholder="Video embed url instructing users"
placeholder="Video embed url instructing users (YouTube or Vimeo)"
type="text"
/>
<label
Expand All @@ -923,7 +923,7 @@ Object {
class="e1urjlvd-el-input"
id="test-static-id"
name="videoUrl2"
placeholder="Video embed url marketing your app"
placeholder="Video embed url marketing your app (YouTube or Vimeo)"
type="text"
/>
<label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ export const formFields: Record<keyof AppEditFormSchema, InputGroupProps & { nam
videoUrl1: {
name: 'videoUrl1',
label: 'Getting Started Video URL',
placeholder: 'Video embed url instructing users',
placeholder: 'Video embed url instructing users (YouTube or Vimeo)',
type: 'text',
},
videoUrl2: {
name: 'videoUrl2',
label: 'Why Use Us Video URL',
placeholder: 'Video embed url marketing your app',
placeholder: 'Video embed url marketing your app (YouTube or Vimeo)',
type: 'text',
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,54 +258,24 @@ export const appEditValidationSchema = object().shape({
[videoUrl1.name]: string()
.trim()
.test({
name: 'isValidYoutube1',
message: 'If YouTube, video needs to be in https://www.youtube.com/embed/<<videoId>> format',
test: (value) => {
if (!value || (!value.includes('youtube') && !value.includes('youtu.be'))) return true
return value.includes('https://www.youtube.com/embed/')
},
})
.test({
name: 'isValidVimeo1',
message: 'If Vimeo, video needs to be in https://player.vimeo.com/video/<<videoId>> format',
test: (value) => {
if (!value || !value.includes('vimeo.com')) return true
return value.includes('https://player.vimeo.com/video/')
},
})
.test({
name: 'isValidVideo1Url',
message: 'Must be a secure https host if supplied',
name: 'isValidVideo1',
message:
'Video needs to be in https://player.vimeo.com/video/<<videoId>> or https://www.youtube.com/embed/<<videoId>> format',
test: (value) => {
if (!value) return true
return isValidHttpsUrl(value)
return value.includes('https://player.vimeo.com/video/') || value.includes('https://www.youtube.com/embed/')
},
}),

[videoUrl2.name]: string()
.trim()
.test({
name: 'isValidYoutube2',
message: 'If YouTube, video needs to be in https://www.youtube.com/embed/<<videoId>> format',
test: (value) => {
if (!value || (!value.includes('youtube') && !value.includes('youtu.be'))) return true
return value.includes('https://www.youtube.com/embed/')
},
})
.test({
name: 'isValidVimeo2',
message: 'If Vimeo, video needs to be in https://player.vimeo.com/video/<<videoId>> format',
test: (value) => {
if (!value || !value.includes('vimeo.com')) return true
return value.includes('https://player.vimeo.com/video/')
},
})
.test({
name: 'isValidVideo2Url',
message: 'Must be a secure https host if supplied',
name: 'isValidVideo2',
message:
'Video needs to be in https://player.vimeo.com/video/<<videoId>> or https://www.youtube.com/embed/<<videoId>> format',
test: (value) => {
if (!value) return true
return isValidHttpsUrl(value)
return value.includes('https://player.vimeo.com/video/') || value.includes('https://www.youtube.com/embed/')
},
}),

Expand Down
5 changes: 1 addition & 4 deletions packages/marketplace/src/components/apps-support/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ export const AppsSupportPage: FC = () => {
<SmallText hasGreyText>
In addition we have provided comprehensive documentation on using the AppMarket at the below link.
</SmallText>
<Button
onClick={openNewPage('https://marketplace-documentation.reapit.cloud/#uninstalling-an-app')}
intent="neutral"
>
<Button onClick={openNewPage('https://marketplace-documentation.reapit.cloud/')} intent="neutral">
View Docs
</Button>
</SecondaryNavContainer>
Expand Down
15 changes: 13 additions & 2 deletions packages/marketplace/src/utils/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { History } from 'history'
import { trackEvent } from '../core/analytics'
import { TrackingEvent } from '../core/analytics-events'
const DESKTOP_CONTEXT_KEY = '__REAPIT_MARKETPLACE_GLOBALS__'

export const openNewPage = (uri: string) => () => {
trackEvent(TrackingEvent.OpenExternalPage, true, { url: uri })
const isDesktop = Boolean(window[DESKTOP_CONTEXT_KEY])

window.open(uri, '_blank')
if (isDesktop) {
window.location.href = `agencycloud://process/webpage?url=${uri}`
} else {
window.open(uri, '_blank')
}
}

export const navigate = (history: History, route: string) => (): void => {
Expand All @@ -22,8 +28,13 @@ export const navigateBack = (history: History) => (): void => {

export const navigateExternal = (uri: string) => (): void => {
trackEvent(TrackingEvent.NavigateExternalPage, true, { url: uri })
const isDesktop = Boolean(window[DESKTOP_CONTEXT_KEY])

window.location.href = uri
if (isDesktop) {
window.location.href = `agencycloud://process/webpage?url=${uri}`
} else {
window.location.href = uri
}
}

export const handleLaunchApp = (connectIsDesktop: boolean, id?: string, launchUri?: string) => () => {
Expand Down

0 comments on commit 40c8d07

Please sign in to comment.