Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/jwplayer/ott-web-app int…
Browse files Browse the repository at this point in the history
…o feat/custom-reg-fields
  • Loading branch information
mirovladimitrovski committed Jul 21, 2023
2 parents 1a8a70c + a7d2288 commit 262dbbe
Show file tree
Hide file tree
Showing 160 changed files with 1,869 additions and 1,202 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ APP_PLAYER_ID=M4qoGvUk
APP_DEFAULT_LANGUAGE=en

# a comma separated list of languages that are enabled (this only works for languages that are enabled in the app)
APP_ENABLED_LANGUAGES=en,es
APP_ENABLED_LANGUAGES=en,es
47 changes: 47 additions & 0 deletions .github/workflows/create-release-candidate-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Create Release Candidate Branch

# Triggered manually
on:
workflow_dispatch:

permissions:
contents: write
jobs:
create-release-branch:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.ACTION_TOKEN }}
ref: release
# It would be easier to create the branch from develop,
# but unfortunately the script that creates the PR's only considers commits added during the action run
- name: Merge latest from develop
run: |
git config --global user.name 'Release Script'
git config --global user.email 'ott-release-script@jwplayer.com'
git fetch origin develop
git merge origin/develop
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}

- name: Generate changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.ACTION_TOKEN }}
release-count: 0
skip-tag: true
git-push: false

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.ACTION_TOKEN }}
title: ${{ steps.changelog.outputs.tag }} Release Candidate
base: release
branch: release-candidate
body: ${{ steps.changelog.outputs.clean_changelog }}
labels: release-candidate
7 changes: 4 additions & 3 deletions .github/workflows/firebase-live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Firebase Live'

on:
push:
branches: ['develop']
branches: ['release']

jobs:
deploy_live_website:
Expand All @@ -12,9 +12,10 @@ jobs:
- name: Build
env:
APP_PLAYER_LICENSE_KEY: ${{ secrets.PLAYER_LICENSE_KEY }}
APP_GOOGLE_SITE_VERIFICATION_ID: ${{ vars.GOOGLE_SITE_VERIFICATION_ID }}
run: yarn && MODE=demo yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
channelId: live
25 changes: 20 additions & 5 deletions .github/workflows/firebase-preview.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
name: 'Firebase Preview'
name: Preview and Lighthouse

on:
pull_request:
branches: [ 'develop', 'feat/*', 'feature/*' ]
branches: ['develop', 'feat/*', 'feature/*', 'release']

jobs:
build_and_preview:
name: Build and preview
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.firebase_hosting_preview.outputs.details_url }}
steps:
- uses: actions/checkout@v2
- name: Build
- name: Build Preview Link
env:
APP_PLAYER_LICENSE_KEY: ${{ secrets.PLAYER_LICENSE_KEY }}
run: yarn && MODE=preview yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
id: firebase_hosting_preview
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
expires: 30d

lhci:
name: Lighthouse
runs-on: ubuntu-latest
needs: build_and_preview
steps:
- uses: actions/checkout@v2
- name: Install Lighthouse CI
run: sudo yarn global add @lhci/cli@0.12.x
- name: Run Lighthouse CI
run: lhci autorun --collect.url=${{ needs.build_and_preview.outputs.output1 }}?app-config=gnnuzabk --config=./lighthouserc.js
22 changes: 0 additions & 22 deletions .github/workflows/lhci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Release
on:
# Triggers the workflow on push or pull request events but only for the "develop" branch
push:
branches: ['develop']
branches: ['release']

jobs:
create-new-release-version:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ yarn-error.log
.firebase
firebase-debug.log
.stylelintcache
.lighthouseci

# os or editor
.idea
Expand Down
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
## [4.23.2](https://github.com/jwplayer/ott-web-app/compare/v4.23.1...v4.23.2) (2023-07-06)


### Bug Fixes

* **deps:** bump @sideway/formula from 3.0.0 to 3.0.1 ([#309](https://github.com/jwplayer/ott-web-app/issues/309)) ([8dbb314](https://github.com/jwplayer/ott-web-app/commit/8dbb3145a866237b9cb07e2e61caf69bac2a1d55))



## [4.23.1](https://github.com/jwplayer/ott-web-app/compare/v4.23.0...v4.23.1) (2023-07-06)


### Bug Fixes

* **project:** add meta tag for GA ([#330](https://github.com/jwplayer/ott-web-app/issues/330)) ([87db5f9](https://github.com/jwplayer/ott-web-app/commit/87db5f9a5dc2ab42117267933b5a914825a756bb))



# [4.23.0](https://github.com/jwplayer/ott-web-app/compare/v4.22.0...v4.23.0) (2023-07-06)


### Features

* av ([743af3e](https://github.com/jwplayer/ott-web-app/commit/743af3e4b855fed61178f2b8f52757edeb944e6f))
* code cleanup ([13a1e21](https://github.com/jwplayer/ott-web-app/commit/13a1e2120adf9486fb4e34b8544726811331c4c3))
* comment fix ([6ab4dcb](https://github.com/jwplayer/ott-web-app/commit/6ab4dcbff33f95539cbf8c20fc18b67976463f07))
* fix vite config definition ([2d772ed](https://github.com/jwplayer/ott-web-app/commit/2d772ed52ae835485fe48ffc4a0b3352ab9edcb5))
* oiid for analytics ([898f94a](https://github.com/jwplayer/ott-web-app/commit/898f94a6683dfcc18020deef90fc8a1bc987b6b3))
* update docs ([1fa1bcf](https://github.com/jwplayer/ott-web-app/commit/1fa1bcf093ff24514ead4e2a4ae943badf6f0871))



# [4.22.0](https://github.com/jwplayer/ott-web-app/compare/v4.21.0...v4.22.0) (2023-07-05)


### Features

* **project:** remove github pages ([a83bfe9](https://github.com/jwplayer/ott-web-app/commit/a83bfe9ac5087def6d46bebce2b226ec80313cbf))
* **project:** remove hash routing ([91acf86](https://github.com/jwplayer/ott-web-app/commit/91acf86508b9b93fbb7ef965b12aa05ac8e5b246))



# [4.21.0](https://github.com/jwplayer/ott-web-app/compare/v4.20.0...v4.21.0) (2023-07-05)


### Features

* **project:** test cases for analytics ([2abf28b](https://github.com/jwplayer/ott-web-app/commit/2abf28b88cb716efb33ac154e375285c307e7246))
* **project:** test cases for analytics ([41f900d](https://github.com/jwplayer/ott-web-app/commit/41f900d88361b862048e281e00ffe27fc5ec7c04))



# [4.20.0](https://github.com/jwplayer/ott-web-app/compare/v4.19.1...v4.20.0) (2023-07-04)


### Features

* **project:** add variable for GA ([fa0e0d7](https://github.com/jwplayer/ott-web-app/commit/fa0e0d75e20ea506bb2ebde92f9744e1645cab16))



## [4.19.1](https://github.com/jwplayer/ott-web-app/compare/v4.19.0...v4.19.1) (2023-06-20)


Expand Down
2 changes: 1 addition & 1 deletion docs/backend-services.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Backend dependencies and architecture

The application is built as a single page web app that can run without its own dedicated backend. This is useful for
hosting it with a very simple, static host, like github pages. The server serves the static web content and the frontend
hosting it with a very simple, static host. The server serves the static web content and the frontend
calls the [JW Player Delivery API](https://developer.jwplayer.com/jwplayer/docs) directly.
However, for additional functionality, the application can also connect to other backends to provide user
accounts / authentication, subscription management, and checkout flows.
Expand Down
6 changes: 0 additions & 6 deletions docs/build-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,3 @@ It is recommended that this value be provided via a .env.local file or a github

If you are using pre-compiled builds instead of building the code yourself, you can also set this value with the [playerLicenseKey ini setting](initialization-file.md#playerLicenseKey).
Keep in mind, if the [playerLicenseKey ini setting](initialization-file.md#playerLicenseKey) is provided, it will be used even if the `APP_PLAYER_LICENSE_KEY` environment variable is set.

### APP_GITHUB_PUBLIC_BASE_URL

This value is used to set the URL of links in the app correctly when running on [github pages](easy-deployments.md#github-pages).
By default, if `APP_GITHUB_PUBLIC_BASE_URL` is empty, the value will be based on the `git remote get-url origin` command.
You can also pass your own `APP_GITHUB_PUBLIC_BASE_URL` envvar by running `APP_GITHUB_PUBLIC_BASE_URL=/my-base/ yarn deploy:github`.
39 changes: 39 additions & 0 deletions docs/content-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# What are content types?

In order to map data coming from the JWP delivery pipeline to the correct screen components in the app,
we use the concept of 'content types'.
Basically, a content type is simply a custom parameter named 'contentType' on a media item with a value defining which type the media is (movie, trailer, series, etc.)

In the app, content types often map to specific screens (see [screenMapping.ts](src/screenMapping.ts) and [MediaScreenRouter.tsx](src/pages/ScreenRouting/MediaScreenRouter.tsx).)
Each content type screen often expects different metadata attached to the media item's custom parameters.

# Using content types in the JWP dashboard

To help ensure that content editors use the right content types and custom parameters, the JWP dashboard has a content type feature.
You can upload the schema for the content types that your app expects.
Content editors will then be able to choose a content type for each media item and will see the expected metadata when they are editing the item on the dashboard.

> Note: Content types on the JWP dashboard requires a specific entitlement. Please speak with your account rep to enable this feature for your account.
## Uploading content types to the dashboard

In order to quickly upload the content types, you can use the yarn script included with this repository as so:

`yarn load-content-types --site-id=<site id>`

By default, the script will load the content types that the vanilla web app expects found in [content-types.json](scripts/content-types/content-types.json).
You can modify this file in your fork of the web app code or optionally specify another file to load by adding a `--source-file=<file path>` param to the yarn script call.

### Content type upload file definition

The upload file should be a json property with the schemas defined as an array on the `schemas` property on the root object.
Please refer to [content-types.json](scripts/content-types/content-types.json) and the JWP documentation for the schema format.

To avoid unnecessary duplication the file also allows some basic abstraction.
You can define reused fields and sections as key-value entries on the `fields` and `sections` properties respectively.
Then you can include these reusable entities by putting their string key into schemas the same way that you would for inline fields or sections.
There are many examples in the included [content-types.json](scripts/content-types/content-types.json)

> Note: Although the upload file allows you to define reused fields and sections, when these are uploaded they become distinct copies for each instance in the schemas where they are used.
> That means that changing fields and sections via the api after they are uploaded must be done individually for each schema.
> Alternatively, you can re-upload and overwrite the existing schemas, but use caution because you will lose any other manual changes you have made.
25 changes: 0 additions & 25 deletions docs/easy-deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ The instructions in this document will help you deploy your fork of the ott-web-
## Supported Platforms

- [Google Firebase](#google-firebase): Free, easy to use [web hosting service](https://firebase.google.com/) with [integrations](https://firebase.google.com/docs/hosting/github-integration) to deploy directly from github
- [GitHub Pages](#github-pages): Static hosting [directly from a repository](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages) though with some limitations

### Google Firebase

Expand All @@ -25,27 +24,3 @@ First, in your fork, you will need to update the project ID in [.firebaserc](.fi
The easiest way to deploy is to use the [Firebase-Github integration](https://firebase.google.com/docs/hosting/github-integration). You can find the action [.yml specifications here](https://github.com/marketplace/actions/deploy-to-firebase-hosting) to deploy to a preview channel for each PR and to the live channel for each merge to your main branch. If you want to manually setup the work, you can find those instructions [here](https://github.com/FirebaseExtended/action-hosting-deploy/blob/main/docs/service-account.md).

You can also manually deploy using the Firebase CLI, as described [here](https://firebase.google.com/docs/hosting/quickstart).

### Github Pages

#### Technical Limitations

Github pages is bare bones static hosting, not optimized for single page apps. This means that urls do not automatically redirect to index.html. For this reason, the Github deploy scripts configure the application to use [hash routing](https://v5.reactrouter.com/web/api/HashRouter), which may be undesirable for production applications.

Github pages also has some [usage limits](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#usage-limits). These limits are determined by Github and are likely to change and evolve, but at the moment they are primarily on the repo size, the bandwidth, and the number of builds per hour. After reviewing the current Github pages limits, if you anticipate exceeding these, you should consider other paid hosting solutions.

#### Usage Instructions

1. (Optional) If you need a customization option, review `yarn deploy:github --help`.
2. Confirm that you can [build this project from source](./build-from-source.md). Be sure to install optional dependencies.
3. Enable the [Github Pages feature](https://docs.github.com/en/pages/getting-started-with-github-pages) for the `gh-pages` branch in your repository.
4. Run `yarn deploy:github`. Be sure to follow the instructions that appear on the screen. If you want to connect your github deployment to a custom domain remember to add `--custom-domain=mydomain.com`.

### Technical Documentation

The `yarn deploy:github` command executes a simple nodejs script located in `scripts/deploy-github.js`. The script executes the following commands:

1. Runs `yarn build` with [`APP_GITHUB_PUBLIC_BASE_URL`](build-from-source.md#APP_GITHUB_PUBLIC_BASE_URL) envvar.
2. Runs `yarn gh-pages -o origin -d build`.<br /><br />You can change the remote from _origin_ to _myremote_ by running `yarn deploy:github --github-remote=myremote`. The `yarn deploy:github` command uses the GitHub remote to compute the default value for `APP_GITHUB_PUBLIC_BASE_URL`.

> **TIP**: Before each of the previous steps, the script will ask if you want to continue. You can prevent these confirmation inquiries by providing `--build` or `--deploy` arguments to `yarn deploy:github`.
12 changes: 6 additions & 6 deletions docs/features/video-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ These metrics are described below.

### App Metrics

| Name | Key | Rqd | Values | Example | Description |
| ----------------------- | ---- | --- | ------------------- | ---------------------------------------- | --------------------------------------------------- |
| App Version | av | Yes | A string | 1.0.0 | Version of the App |
| App Bundle ID | bun | Yes | Reverse domain name | com.apple.calculator | Unique ID to the App; persists through uninstalls. |
| App User ID | oaid | Yes | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | Hash of the app user account login ID. <sup>1</sub> |
| App Install Instance ID | oiid | No | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | App install instance ID. Resets with reinstalls |
| Name | Key | Rqd | Values | Example | Description |
| ------------- | ---- | --- | ------------------- | ---------------------------------------- | --------------------------------------------------- |
| App Version | av | Yes | A string | 1.0.0 | Version of the App |
| App Bundle ID | bun | Yes | Reverse domain name | com.apple.calculator | Unique ID to the App; persists through uninstalls. |
| App User ID | oaid | Yes | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | Hash of the app user account login ID. <sup>1</sub> |
| App Config ID | oiid | No | \[0-9a-z\]{8} | dGSUzs9o | Unique ID of app config. |

<sup>1</sup> For Cleeng `oaid` maps to the `subscriberId`

Expand Down
13 changes: 8 additions & 5 deletions lighthouserc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
module.exports = {
ci: {
collect: {
url: ['http://127.0.0.1:4000'],
startServerCommand: 'http-server ./build -p 4000 -g',
startServerReadyPattern: 'Available on',
numberOfRuns: 1,
numberOfRuns: 3,
},
upload: {
target: 'temporary-public-storage',
},
assert: {
preset: 'lighthouse:no-pwa',
assertions: {
'categories:performance': ['warn', { minScore: 0.9 }],
'categories:seo': ['error', { minScore: 0.9 }],
'categories:accessibility': ['warn', { minScore: 0.9 }],
'categories:best-practices': ['warn', { minScore: 0.9 }],
'categories:pwa': ['warn', { minScore: 0.9 }],
},
},
},
};
Loading

0 comments on commit 262dbbe

Please sign in to comment.