diff --git a/packages/artplayer-document/README.md b/packages/artplayer-document/README.md index 55d0c3ef4..231a499c0 100644 --- a/packages/artplayer-document/README.md +++ b/packages/artplayer-document/README.md @@ -2,32 +2,32 @@ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. -### Installation +## Installation -``` -$ yarn +```console +yarn install ``` -### Local Development +## Local Development -``` -$ yarn start +```console +yarn start ``` This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. -### Build +## Build -``` -$ yarn build +```console +yarn build ``` This command generates static content into the `build` directory and can be served using any static contents hosting service. -### Deployment +## Deployment -``` -$ GIT_USER= USE_SSH=true yarn deploy +```console +GIT_USER= USE_SSH=true yarn deploy ``` If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. diff --git a/packages/artplayer-document/docs/en/Basic Services/1.User Registration.md b/packages/artplayer-document/docs/en/Basic Services/1.User Registration.md new file mode 100644 index 000000000..7a76ef2fc --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/1.User Registration.md @@ -0,0 +1,61 @@ +--- +sidebar_position: 1 +--- + +All other services can be used only after user + +## Description + +**Provider:** `Awda` + +**Service url:** `/welab-sun/api/user/register` + +**Dependency:** `NO` + +**Request method** `POST` + +## Request body + +| Param | Type | Required | Description | +| ------- | ------ | -------- | ---------------------- | +| body | | Yes | | +| -mobile | String | Yes | Customer mobile number | +| -name | String | Yes | Customer name | +| -nik | String | Yes | Customer NIK | +| -email | String | Yes | Customer email | + +Request Sample: + +```json +{ + "body":{ + "email": "xxx", + "mobile": "xxx", + "name": "xxx", + "nik": "xxx" + }, + "timestamp":"1488363493", + "signature":"B3C14758F4AF52AE8AA0D4CD1493B137", + "appId":"111", + "v":"1.0" +} +``` + +## Response (Json format) + +| Param | Type | Required | Description | +| ------- | ------- | -------- | ------------ | +| code | Integer | Yes | Status code | +| message | String | Yes | Code message | +| result | Object | No | Return data | + + +Sample response for success request: + +```json +{ + "code":0, + "message":"Permintaan berhasil", + "result":null +} +``` \ No newline at end of file diff --git a/packages/artplayer-document/docs/en/Basic Services/10.Sign agreement.md b/packages/artplayer-document/docs/en/Basic Services/10.Sign agreement.md new file mode 100644 index 000000000..41ecc564c --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/10.Sign agreement.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 10 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/11.Get loan information.md b/packages/artplayer-document/docs/en/Basic Services/11.Get loan information.md new file mode 100644 index 000000000..33551c0da --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/11.Get loan information.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 11 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/12.Get repayment VA.md b/packages/artplayer-document/docs/en/Basic Services/12.Get repayment VA.md new file mode 100644 index 000000000..724edadf8 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/12.Get repayment VA.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 12 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/13.Push notification.md b/packages/artplayer-document/docs/en/Basic Services/13.Push notification.md new file mode 100644 index 000000000..6562f53ed --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/13.Push notification.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 13 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/14.Eligible Check.md b/packages/artplayer-document/docs/en/Basic Services/14.Eligible Check.md new file mode 100644 index 000000000..c008ed653 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/14.Eligible Check.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 14 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/15.Get the token for uploading image.md b/packages/artplayer-document/docs/en/Basic Services/15.Get the token for uploading image.md new file mode 100644 index 000000000..9095cc478 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/15.Get the token for uploading image.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 15 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/16.Upload Image - By sending file stream.md b/packages/artplayer-document/docs/en/Basic Services/16.Upload Image - By sending file stream.md new file mode 100644 index 000000000..cd77a8173 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/16.Upload Image - By sending file stream.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 16 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/17.Upload Image - By using base64 or url format.md b/packages/artplayer-document/docs/en/Basic Services/17.Upload Image - By using base64 or url format.md new file mode 100644 index 000000000..7ea4b7053 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/17.Upload Image - By using base64 or url format.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 17 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/18.Get the redirect url.md b/packages/artplayer-document/docs/en/Basic Services/18.Get the redirect url.md new file mode 100644 index 000000000..973ce7047 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/18.Get the redirect url.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 18 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/2.Authorization list inquiry.md b/packages/artplayer-document/docs/en/Basic Services/2.Authorization list inquiry.md new file mode 100644 index 000000000..718a60373 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/2.Authorization list inquiry.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 2 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/3.Get the authorization detail page.md b/packages/artplayer-document/docs/en/Basic Services/3.Get the authorization detail page.md new file mode 100644 index 000000000..20cfccebd --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/3.Get the authorization detail page.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 3 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/4.Call back for authorization status.md b/packages/artplayer-document/docs/en/Basic Services/4.Call back for authorization status.md new file mode 100644 index 000000000..4a245f210 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/4.Call back for authorization status.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 4 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/5.Bank card inquiry.md b/packages/artplayer-document/docs/en/Basic Services/5.Bank card inquiry.md new file mode 100644 index 000000000..a4002d439 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/5.Bank card inquiry.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 5 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/6.Get bank list.md b/packages/artplayer-document/docs/en/Basic Services/6.Get bank list.md new file mode 100644 index 000000000..71253e6f3 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/6.Get bank list.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 6 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/7.Bank card verification.md b/packages/artplayer-document/docs/en/Basic Services/7.Bank card verification.md new file mode 100644 index 000000000..e015f7fb4 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/7.Bank card verification.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 7 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/8.Submit loan.md b/packages/artplayer-document/docs/en/Basic Services/8.Submit loan.md new file mode 100644 index 000000000..17894bb5e --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/8.Submit loan.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 8 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/9.Loan agreement inquiry.md b/packages/artplayer-document/docs/en/Basic Services/9.Loan agreement inquiry.md new file mode 100644 index 000000000..a42365a41 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/9.Loan agreement inquiry.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 9 +--- diff --git a/packages/artplayer-document/docs/en/Basic Services/_category_.json b/packages/artplayer-document/docs/en/Basic Services/_category_.json new file mode 100644 index 000000000..d7807c523 --- /dev/null +++ b/packages/artplayer-document/docs/en/Basic Services/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Basic Services", + "position": 5, + "collapsed": false +} \ No newline at end of file diff --git a/packages/artplayer-document/docs/en/Data dictionary.md b/packages/artplayer-document/docs/en/Data dictionary.md new file mode 100644 index 000000000..e662a4926 --- /dev/null +++ b/packages/artplayer-document/docs/en/Data dictionary.md @@ -0,0 +1,195 @@ +--- +title: Data dictionary +sidebar_position: 4 +--- + +## Marriage + +| Code | Description | Note | +| ---- | ------------- | ---- | +| 10 | Belum Menikah | | +| 11 | Menikah | | +| 12 | Cerai | | + +## Education + +| Code | Description | Note | +| ---- | ------------------ | ---- | +| 14 | Sekolah Dasar | | +| 16 | SMP | | +| 13 | SMA | | +| 15 | Diploma/Politehnik | | +| 10 | Sarjana | | +| 11 | Master | | +| 12 | Doctor | | +| 17 | Lain-Lain | | + +## House Ownership + +| Code | Description | Note | +| ---- | -------------- | ---- | +| 10 | Rumah Sendiri | | +| 11 | Rumah Keluarga | | +| 12 | Rumah Dinas | | +| 13 | Sewa/Kontrak | | +| 14 | Kost | | +| 15 | Status Kredit | | +| 16 | Lain-Lain | | + +## Religion + +| Code | Description | Note | +| ---- | ----------------- | ---- | +| 10 | Islam | | +| 11 | Kristen Protestan | | +| 12 | Kristen Katolik | | +| 13 | Hindu | | +| 14 | Budha | | +| 15 | Kong Hu Cu | | + +## Work Type + +| Code | Description | Note | +| ---- | ------------- | ---- | +| 10 | Tetap | | +| 11 | Kontrak | | +| 12 | Outsourcing | | +| 13 | Pekerja Lepas | | +| 14 | Pemilik Usaha | | + +## Position + +| Code | Description | Note | +| ---- | ------------------------ | ---- | +| 10 | Direktur/General Manager | | +| 11 | Manajer | | +| 12 | Asisten Manajer | | +| 13 | Staf | | +| 14 | Pemilik | | + +## Industry + +| Code | Description | Note | +| ---- | ------------------------------------------- | ---- | +| 10 | Perdagangan Eceran / Grosir | | +| 11 | Perbankan / Keuangan / Asuransi / Investasi | | +| 12 | Manufaktur | | +| 13 | Properti / Konstruksi | | +| 14 | Pertambangan / Minyak / Gas | | +| 15 | Pendidikan | | +| 16 | Telekomunikasi | | +| 17 | Pariwisata / Hotel / Perhotelan | | +| 18 | Angkutan | | +| 19 | PNS (Pemerintah) | | +| 20 | Konsultan / Akuntansi / Jasa Profesional | | +| 21 | BUMN (Badan Usaha Milik Negara) | | +| 22 | Perkebunan / Pertanian | | +| 23 | TNI / Polisi (Militer / Polisi) | | +| 24 | Hukum | | +| 25 | Teknologi | | +| 26 | Media / Hiburan | | +| 27 | Pemasaran iklan | | +| 28 | Makanan & Minuman | | +| 29 | Layanan medis | | +| 30 | Perikanan | | + +## Office Ownership + +| Code | Description | Note | +| ---- | ------------- | ---- | +| 10 | Milik Sendiri | | +| 11 | Sewa | | + +## Company Size + +| Code | Description | Note | +| ---- | ----------- | ---- | +| 10 | 1-5 | | +| 11 | 5-10 | | +| 12 | 10-25 | | +| 13 | 25-50 | | +| 14 | >50 | | + +## Occupation + +| Code | Description | Note | +| ---- | ------------------------- | ---- | +| 11 | Pensiunan/Purnawirawan | | +| 12 | Pelayaran/Pelaut | | +| 13 | Guru/Pendidikan | | +| 14 | Jasa | | +| 15 | Dokter/Bidan/Mantri | | +| 16 | Ojek Motor | | +| 17 | Sopir | | +| 18 | Peternak | | +| 19 | Pelajar/Mahasiswa | | +| 20 | Buruh/PRT | | +| 21 | Pengrajin Tangan | | +| 23 | Pedagang | | +| 24 | Produksi | | +| 26 | Sewa/Rent | | +| 27 | Transportasi & Komunikasi | | +| 28 | Hiburan | | +| 29 | Pendidikan Non Formal | | +| 30 | Hotel | | +| 31 | Perangkat Desa | | +| 32 | TNI/Polri | | +| 33 | Atlet | | +| 34 | Pengobatan Alternatif | | +| 2 | ABRI | | +| 3 | Pengacara | | +| 35 | Jurnalis / Wartawan | | +| 37 | Profesi | | +| 36 | Wartawan | | +| 6 | Lain-Lain | | +| 38 | Pekerja Lepas | | + +## Income source + +| Code | Description | Note | +| ---- | ---------------------------------- | ---- | +| 10 | Gaji/Upah | | +| 11 | Laba Usaha | | +| 12 | Uang Tabungan | | +| 13 | Menjual/Menggadaikan Aset | | +| 14 | Dari Keluarga/Teman/Sumber Lainnya | | + +## Relationship with emergency contact + +| Code | Description | Note | +| ---- | --------------- | ---- | +| 10 | Pasangan | | +| 11 | Orang Tua | | +| 12 | Saudara Kandung | | +| 13 | Anak | | +| 14 | Teman Kantor | | + +## Apply reason + +| Code | Description | Note | +| ---- | ----------------------------------------- | ---- | +| 10 | Pembelian Handphone / Laptop / Elektronik | | +| 11 | Tagihan Rutin | | +| 12 | Liburan / Rekreasi | | +| 13 | Pembayaran Pajak | | +| 14 | Asuransi | | +| 15 | Pengobatan Medis | | +| 16 | Pendidikan | | +| 17 | Konsumsi Rumah Tangga | | +| 18 | Modal Usaha | | +| 19 | Multiguna | | + +## Document type + +| Code | Description | Note | +| ----------------------- | ------------------------------------ | ---- | +| bank_statement_3_months | Bank statement for the last 3 months | | +| company_id_card | | | +| ID_PNS | | | +| receiptri | | | +| salary_certificate | | | +| salary_slip_3_months | Salary slip for the last 3 months | | +| self_SKU_SIUP_TDP | | | +| SK_PNS | | | +| driver_license | | | +| KTP | | | \ No newline at end of file diff --git a/packages/artplayer-document/docs/en/Overview.md b/packages/artplayer-document/docs/en/Overview.md new file mode 100644 index 000000000..eaf2ee917 --- /dev/null +++ b/packages/artplayer-document/docs/en/Overview.md @@ -0,0 +1,72 @@ +--- +title: Overview +sidebar_position: 1 +slug: / +--- + +## Integration Guides + +- Require confirmation from AWDA to implement to production after complete UAT for all services. + +- You can use API tools to test some services during your development。 + +- You can check the response code or contact us when you have problems during the testing + +- All services using POST method to send request(Including Inquiry) + +- All requests and responses are JSON format. NOTE: Header Content-Type -> application/json UTF-8 encoding + +- All requests require signature + +## Document Change Control + +| Version | Date | Authors | Summary of changes | +| ------- | ---------- | ------- | -------------------- | +| 1.0.0 | 2019.06.03 | ZHIBO | Thumbnails image url | + +## API Summary + +| **Service name** | **Description** | +| -----------------| --------------- | +| user registration|

Provider : AWDA

User : Third party

Mandatory : YES

Description : All other services can be used only after user registration success

| +| Authorization list inquiry|

Provider : AWDA

User : Third party

Mandatory : NO

Description : Get the authorization list and check the authorization status

| +| Get the authorization detail page|

Provider : AWDA

User : Third party

Mandatory : NO

Description : Customer complete the authorization in the pages

+| Call back for authorization status|

Provider : AWDA

User : Third party

Mandatory : NO

Description : To receive the authorization status

| +| Bank card inquiry|

Provider : AWDA

User : Third party

Mandatory : YES

Description : To inquiry bank card status

| +| Get bank list|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Get the bank list for bank card input

| +| Bank card verification|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Verify and submit bank card

| +| Submit loan|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Submit loan info, including (personal info, work info and emergency contact)

| +| Loan agreement inquiry|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Get loan agreement

| +| Sign agreement|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Sign agreement (Confirm disbursement)

| +| Get loan information|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Get loan info based on loan number (include repayment schedule if disbursed)

| +| Get repayment VA|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Get the repayment VA

| +| Push notification|

Provider: Third party

User : AWDA

Mandatory: NO

Description : Push the loan status update to Third party

| +| Eligible Check|

Provider : AWDA

User : Third party

Mandatory : YES

Description : Verify Customer

| +| Get the token for uploading image|

Provider : AWDA

User : Third party

Mandatory : NO

Description : To get the token which used for api Upload Image (1)

| +| Upload Image (1)|

Provider : AWDA

User : Third party

Mandatory : NO

Description : By sending file stream with token

| +| Upload Image (2)|

Provider : AWDA

User : Third party

Mandatory : NO

Description : By sending base64 or url format

| +| Get the redirect url
(For H5 pages of Digital Signature, Loan detail and Repayment detail) |

Provider : AWDA

User : Third party

Mandatory : NO

Description : Redirect to the specific H5 pages

| + +## Environment information + +- Testing environment:`https://sea-staging.wolaidai.com` +- Production environment:`https://japi.maucash.id` +- Note: All APIs URL will be environment `url` + `service url` + +## List Of Response Code + +| Code|Description| +| ----|----| +| 0 | Success| +| 1000| System is busy| +| 1001| Repeat request| +| 1002| Unvalid token| +| 1003| Timestamp error or expired (only valid within 60s)| +| 1004| Signature error| +| 1005| appId invalid| +| 1006| Parameters cannot be empty| +| 1007| Parameters error| +| 1008| User already existed| +| 1009| User not found| +| 1010| Loan not found| +| 1012| Authorization info not found| \ No newline at end of file diff --git a/packages/artplayer-document/docs/en/Parameters Instructions.md b/packages/artplayer-document/docs/en/Parameters Instructions.md new file mode 100644 index 000000000..14f36b450 --- /dev/null +++ b/packages/artplayer-document/docs/en/Parameters Instructions.md @@ -0,0 +1,81 @@ +--- +title: Parameters Instructions +sidebar_position: 3 +--- + +### Instructions for API request parameters + +:::note +NOTE: The following parameters is included in all services (different values). If no parameters for body then pass blank, like body:”” +::: + +| Name|Description|Type|Mandatory|Notes| +| ----|----|----|----|----| +| body|Business parameters|Object|N|Some APIs may require body| +| timestamp|Timestamp|Long|Y|Accurate into a second| +| appId|Apply from AWDA|String|Y| +| v|Version code|String|N|Default 1.0| +| signature|Signature|String|Y|All requests need signature| + +example: + +```json +{ + "body": "1111", + "timestamp": 1488363493, + "signature": "B3C14758F4AF52AE8AA0D4CD1493B137", + "appId": "111", + "v":"1.0" +} +``` + +### Rules for signature + +Rules for signature: + +- Step 1:Sort the parameters alphabetically by key name. Result will be: appId、body、timestamp、v +- Step 2:Combine key and value of all the parameters. Result will be: appId:123456body:{"orderNo":"1234567"}timestamp:1558923813v:1.0 +- Step 3:Add secret to the last of the result from step 2, which will become the signature. Result will be: appId:123456body:{"orderNo":"1234567"}timestamp:1558923813v:1.0yoursecret +- Step 4:MD5 encryption of the signature string. Result will be: `B6F6E3F9ADF4D7558F54BC8B7D9869CC` + + +### Java Sample Codes for Signature + +```java +String[] keys = new String[map.size()]; +int i = 0; +for (Map.Entry entry : map.entrySet()) { + keys[i++] = entry.getKey(); +} +Arrays.sort(keys); +StringBuilder stringBuilder = new StringBuilder(); +for (String key : keys) { + stringBuilder.append(key); + stringBuilder.append(":"); + stringBuilder.append(map.get(key)); +} +stringBuilder.append(secret); +String str=stringBuilder.toString(); +String encodeStr = DigestUtils.md5Hex(str).toUpperCase(); +return encodeStr ; +``` + +### API Response + +| Parameters|DescriptionType|Mandatory|Notes| +| ----|----|----|----|----| +| code|Status code|Integer|Y|

0: Success

Other codes all represent failure, find more details in Code List

| +| message|Status description|String|Y|Code description| +| result|Return data|Object|N|When code=0, there will be business data returned inside result object| + +### Sample response for success request: + +```json +{ + "code": 0, + "message": "Permintaan berhasil", + "result": { + "state": true + } +} +``` \ No newline at end of file diff --git a/packages/artplayer-document/docs/en/UML Diagram.md b/packages/artplayer-document/docs/en/UML Diagram.md new file mode 100644 index 000000000..e124bffa1 --- /dev/null +++ b/packages/artplayer-document/docs/en/UML Diagram.md @@ -0,0 +1,24 @@ +--- +title: UML Diagram +sidebar_position: 2 +--- + +### Authorization + +![logo](/img/Authorization.png) + +### Submit Bank Card + +![logo](/img/SubmitBankCard.png) + +### Submit Loan + +![logo](/img/ApplyForLloan.png) + +### Sign Contract + +![logo](/img/ContractContract.png) + +### Payment Inquiry + +![logo](/img/RepaymentInformation.png) diff --git a/packages/artplayer-document/docs/intro.md b/packages/artplayer-document/docs/intro.md deleted file mode 100644 index 8417aebee..000000000 --- a/packages/artplayer-document/docs/intro.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Tutorial Intro - -Let's discover **Docusaurus in less than 5 minutes**. - -## Getting Started - -Get started by **creating a new site**. - -Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**. - -## Generate a new site - -Generate a new Docusaurus site using the **classic template**: - -```shell -npm init docusaurus@latest my-website classic -``` - -## Start your site - -Run the development server: - -```shell -cd my-website - -npx docusaurus start -``` - -Your site starts at `http://localhost:3000`. - -Open `docs/intro.md` and edit some lines: the site **reloads automatically** and displays your changes. diff --git a/packages/artplayer-document/docs/tutorial-basics/_category_.json b/packages/artplayer-document/docs/tutorial-basics/_category_.json deleted file mode 100644 index 135e4a685..000000000 --- a/packages/artplayer-document/docs/tutorial-basics/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Tutorial - Basics", - "position": 2 -} diff --git a/packages/artplayer-document/docs/tutorial-basics/congratulations.md b/packages/artplayer-document/docs/tutorial-basics/congratulations.md deleted file mode 100644 index 9ef99bbad..000000000 --- a/packages/artplayer-document/docs/tutorial-basics/congratulations.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_position: 6 ---- - -# Congratulations! - -You have just learned the **basics of Docusaurus** and made some changes to the **initial template**. - -Docusaurus has **much more to offer**! - -Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.md)** and **[i18n](../tutorial-extras/translate-your-site.md)**. - -Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610) - -## What's next? - -- Read the [official documentation](https://docusaurus.io/). -- Add a custom [Design and Layout](https://docusaurus.io/docs/styling-layout) -- Add a [search bar](https://docusaurus.io/docs/search) -- Find inspirations in the [Docusaurus showcase](https://docusaurus.io/showcase) -- Get involved in the [Docusaurus Community](https://docusaurus.io/community/support) diff --git a/packages/artplayer-document/docs/tutorial-basics/create-a-blog-post.md b/packages/artplayer-document/docs/tutorial-basics/create-a-blog-post.md deleted file mode 100644 index 0d50aaf31..000000000 --- a/packages/artplayer-document/docs/tutorial-basics/create-a-blog-post.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Create a Blog Post - -Docusaurus creates a **page for each blog post**, but also a **blog index page**, a **tag system**, an **RSS** feed... - -## Create your first Post - -Create a file at `blog/2021-02-28-greetings.md`: - -```md title="blog/2021-02-28-greetings.md" ---- -slug: greetings -title: Greetings! -authors: - - name: Joel Marcey - title: Co-creator of Docusaurus 1 - url: https://github.com/JoelMarcey - image_url: https://github.com/JoelMarcey.png - - name: Sébastien Lorber - title: Docusaurus maintainer - url: https://sebastienlorber.com - image_url: https://github.com/slorber.png -tags: [greetings] ---- - -Congratulations, you have made your first post! - -Feel free to play around and edit this post as much you like. -``` - -A new blog post is now available at `http://localhost:3000/blog/greetings`. diff --git a/packages/artplayer-document/docs/tutorial-basics/create-a-document.md b/packages/artplayer-document/docs/tutorial-basics/create-a-document.md deleted file mode 100644 index b4a072ecd..000000000 --- a/packages/artplayer-document/docs/tutorial-basics/create-a-document.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Create a Document - -Documents are **groups of pages** connected through: - -- a **sidebar** -- **previous/next navigation** -- **versioning** - -## Create your first Doc - -Create a markdown file at `docs/hello.md`: - -```md title="docs/hello.md" -# Hello - -This is my **first Docusaurus document**! -``` - -A new document is now available at `http://localhost:3000/docs/hello`. - -## Configure the Sidebar - -Docusaurus automatically **creates a sidebar** from the `docs` folder. - -Add metadatas to customize the sidebar label and position: - -```md title="docs/hello.md" {1-4} ---- -sidebar_label: 'Hi!' -sidebar_position: 3 ---- - -# Hello - -This is my **first Docusaurus document**! -``` - -It is also possible to create your sidebar explicitly in `sidebars.js`: - -```diff title="sidebars.js" -module.exports = { - tutorialSidebar: [ - { - type: 'category', - label: 'Tutorial', -- items: [...], -+ items: ['hello'], - }, - ], -}; -``` diff --git a/packages/artplayer-document/docs/tutorial-basics/create-a-page.md b/packages/artplayer-document/docs/tutorial-basics/create-a-page.md deleted file mode 100644 index e112b0059..000000000 --- a/packages/artplayer-document/docs/tutorial-basics/create-a-page.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Create a Page - -Add **Markdown or React** files to `src/pages` to create a **standalone page**: - -- `src/pages/index.js` -> `localhost:3000/` -- `src/pages/foo.md` -> `localhost:3000/foo` -- `src/pages/foo/bar.js` -> `localhost:3000/foo/bar` - -## Create your first React Page - -Create a file at `src/pages/my-react-page.js`: - -```jsx title="src/pages/my-react-page.js" -import React from 'react'; -import Layout from '@theme/Layout'; - -export default function MyReactPage() { - return ( - -

My React page

-

This is a React page

-
- ); -} -``` - -A new page is now available at `http://localhost:3000/my-react-page`. - -## Create your first Markdown Page - -Create a file at `src/pages/my-markdown-page.md`: - -```mdx title="src/pages/my-markdown-page.md" -# My Markdown page - -This is a Markdown page -``` - -A new page is now available at `http://localhost:3000/my-markdown-page`. diff --git a/packages/artplayer-document/docs/tutorial-basics/deploy-your-site.md b/packages/artplayer-document/docs/tutorial-basics/deploy-your-site.md deleted file mode 100644 index 492eae027..000000000 --- a/packages/artplayer-document/docs/tutorial-basics/deploy-your-site.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -sidebar_position: 5 ---- - -# Deploy your site - -Docusaurus is a **static-site-generator** (also called **[Jamstack](https://jamstack.org/)**). - -It builds your site as simple **static HTML, JavaScript and CSS files**. - -## Build your site - -Build your site **for production**: - -```bash -npm run build -``` - -The static files are generated in the `build` folder. - -## Deploy your site - -Test your production build locally: - -```bash -npm run serve -``` - -The `build` folder is now served at `http://localhost:3000/`. - -You can now deploy the `build` folder **almost anywhere** easily, **for free** or very small cost (read the **[Deployment Guide](https://docusaurus.io/docs/deployment)**). diff --git a/packages/artplayer-document/docs/tutorial-basics/markdown-features.mdx b/packages/artplayer-document/docs/tutorial-basics/markdown-features.mdx deleted file mode 100644 index 885562605..000000000 --- a/packages/artplayer-document/docs/tutorial-basics/markdown-features.mdx +++ /dev/null @@ -1,144 +0,0 @@ ---- -sidebar_position: 4 ---- - -# Markdown Features - -Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/syntax)** and a few **additional features**. - -## Front Matter - -Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/): - -```text title="my-doc.md" -// highlight-start ---- -id: my-doc-id -title: My document title -description: My document description -slug: /my-custom-url ---- -// highlight-end - -## Markdown heading - -Markdown text with [links](./hello.md) -``` - -## Links - -Regular Markdown links are supported, using url paths or relative file paths. - -```md -Let's see how to [Create a page](/create-a-page). -``` - -```md -Let's see how to [Create a page](./create-a-page.md). -``` - -**Result:** Let's see how to [Create a page](./create-a-page.md). - -## Images - -Regular Markdown images are supported. - -Add an image at `static/img/docusaurus.png` and display it in Markdown: - -```md -![Docusaurus logo](/img/docusaurus.png) -``` - -![Docusaurus logo](/img/docusaurus.png) - -## Code Blocks - -Markdown code blocks are supported with Syntax highlighting. - - ```jsx title="src/components/HelloDocusaurus.js" - function HelloDocusaurus() { - return ( -

Hello, Docusaurus!

- ) - } - ``` - -```jsx title="src/components/HelloDocusaurus.js" -function HelloDocusaurus() { - return

Hello, Docusaurus!

; -} -``` - -## Admonitions - -Docusaurus has a special syntax to create admonitions and callouts: - - :::tip My tip - - Use this awesome feature option - - ::: - - :::danger Take care - - This action is dangerous - - ::: - -:::tip My tip - -Use this awesome feature option - -::: - -:::danger Take care - -This action is dangerous - -::: - -## MDX and React Components - -[MDX](https://mdxjs.com/) can make your documentation more **interactive** and allows using any **React components inside Markdown**: - -```jsx -export const Highlight = ({children, color}) => ( - { - alert(`You clicked the color ${color} with label ${children}`) - }}> - {children} - -); - -This is Docusaurus green ! - -This is Facebook blue ! -``` - -export const Highlight = ({children, color}) => ( - { - alert(`You clicked the color ${color} with label ${children}`); - }}> - {children} - -); - -This is Docusaurus green ! - -This is Facebook blue ! diff --git a/packages/artplayer-document/docs/tutorial-extras/_category_.json b/packages/artplayer-document/docs/tutorial-extras/_category_.json deleted file mode 100644 index ca3f8e064..000000000 --- a/packages/artplayer-document/docs/tutorial-extras/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Tutorial - Extras", - "position": 3 -} diff --git a/packages/artplayer-document/docs/tutorial-extras/manage-docs-versions.md b/packages/artplayer-document/docs/tutorial-extras/manage-docs-versions.md deleted file mode 100644 index 6335b0ac9..000000000 --- a/packages/artplayer-document/docs/tutorial-extras/manage-docs-versions.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Manage Docs Versions - -Docusaurus can manage multiple versions of your docs. - -## Create a docs version - -Release a version 1.0 of your project: - -```bash -npm run docusaurus docs:version 1.0 -``` - -The `docs` folder is copied into `versioned_docs/version-1.0` and `versions.json` is created. - -Your docs now have 2 versions: - -- `1.0` at `http://localhost:3000/docs/` for the version 1.0 docs -- `current` at `http://localhost:3000/docs/next/` for the **upcoming, unreleased docs** - -## Add a Version Dropdown - -To navigate seamlessly across versions, add a version dropdown. - -Modify the `docusaurus.config.js` file: - -```js title="docusaurus.config.js" -module.exports = { - themeConfig: { - navbar: { - items: [ - // highlight-start - { - type: 'docsVersionDropdown', - }, - // highlight-end - ], - }, - }, -}; -``` - -The docs version dropdown appears in your navbar: - -![Docs Version Dropdown](/img/tutorial/docsVersionDropdown.png) - -## Update an existing version - -It is possible to edit versioned docs in their respective folder: - -- `versioned_docs/version-1.0/hello.md` updates `http://localhost:3000/docs/hello` -- `docs/hello.md` updates `http://localhost:3000/docs/next/hello` diff --git a/packages/artplayer-document/docs/tutorial-extras/translate-your-site.md b/packages/artplayer-document/docs/tutorial-extras/translate-your-site.md deleted file mode 100644 index a25c089ed..000000000 --- a/packages/artplayer-document/docs/tutorial-extras/translate-your-site.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Translate your site - -Let's translate `docs/intro.md` to French. - -## Configure i18n - -Modify `docusaurus.config.js` to add support for the `fr` locale: - -```js title="docusaurus.config.js" -module.exports = { - i18n: { - defaultLocale: 'en', - locales: ['en', 'fr'], - }, -}; -``` - -## Translate a doc - -Copy the `docs/intro.md` file to the `i18n/fr` folder: - -```bash -mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/ - -cp docs/intro.md i18n/fr/docusaurus-plugin-content-docs/current/intro.md -``` - -Translate `i18n/fr/docusaurus-plugin-content-docs/current/intro.md` in French. - -## Start your localized site - -Start your site on the French locale: - -```bash -npm run start -- --locale fr -``` - -Your localized site is accessible at `http://localhost:3000/fr/` and the `Getting Started` page is translated. - -:::caution - -In development, you can only use one locale at a same time. - -::: - -## Add a Locale Dropdown - -To navigate seamlessly across languages, add a locale dropdown. - -Modify the `docusaurus.config.js` file: - -```js title="docusaurus.config.js" -module.exports = { - themeConfig: { - navbar: { - items: [ - // highlight-start - { - type: 'localeDropdown', - }, - // highlight-end - ], - }, - }, -}; -``` - -The locale dropdown now appears in your navbar: - -![Locale Dropdown](/img/tutorial/localeDropdown.png) - -## Build your localized site - -Build your site for a specific locale: - -```bash -npm run build -- --locale fr -``` - -Or build your site to include all the locales at once: - -```bash -npm run build -``` diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/1.User Registration.md b/packages/artplayer-document/docs/zh-cn/Basic Services/1.User Registration.md new file mode 100644 index 000000000..07d9222c4 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/1.User Registration.md @@ -0,0 +1,62 @@ +--- +title: 用户创建 +sidebar_position: 1 +--- + +用户创建,只有在用户创建成功后才能调用其他业务接口,例如:绑卡、授权 + +## 接口描述 + +**接口提供方:** `Awda` + +**接口地址:** `/welab-sun/api/user/register` + +**前置调用:** `NO` + +**请求方式** `POST` + +## 参数说明 + +| 参数名称 | 中文含义 | 类型 | 必选 | 备注 | +| -------- | -------- | ------ | ---- | ---- | +| body | | | 是 | | +| -mobile | 手机号 | String | 是 | | +| -name | 用户姓名 | String | 是 | | +| -nik | 身份证 | String | 是 | | +| -email | 邮箱 | String | 是 | | + +请求参数 - 例: + +```json +{ + "body":{ + "email": "xxx", + "mobile": "xxx", + "name": "xxx", + "nik": "xxx" + }, + "timestamp":"1488363493", + "signature":"B3C14758F4AF52AE8AA0D4CD1493B137", + "appId":"111", + "v":"1.0" +} +``` + +## 响应数据(返回结果,Json格式) + +| 参数名称 | 中文含义 | 类型 | 必选 | 备注 | +| -------- | ---------- | ------- | ---- | ---- | +| code | 返回码 | Integer | 是 | | +| message | 返回信息 | String | 是 | | +| result | 返回结果集 | Object | 否 | | + + +正确响应的JSON - 例: + +```json +{ + "code":0, + "message":"Permintaan berhasil", + "result":null +} +``` \ No newline at end of file diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/10.Sign agreement.md b/packages/artplayer-document/docs/zh-cn/Basic Services/10.Sign agreement.md new file mode 100644 index 000000000..2501ea5e0 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/10.Sign agreement.md @@ -0,0 +1,4 @@ +--- +title: 签约(确认放款) +sidebar_position: 10 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/11.Get loan information.md b/packages/artplayer-document/docs/zh-cn/Basic Services/11.Get loan information.md new file mode 100644 index 000000000..5cf3184c6 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/11.Get loan information.md @@ -0,0 +1,4 @@ +--- +title: 贷款信息查询 +sidebar_position: 11 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/12.Get repayment VA.md b/packages/artplayer-document/docs/zh-cn/Basic Services/12.Get repayment VA.md new file mode 100644 index 000000000..3858b1798 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/12.Get repayment VA.md @@ -0,0 +1,4 @@ +--- +title: 用户还款虚拟账号查询 +sidebar_position: 12 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/13.Push notification.md b/packages/artplayer-document/docs/zh-cn/Basic Services/13.Push notification.md new file mode 100644 index 000000000..bf66e12d3 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/13.Push notification.md @@ -0,0 +1,4 @@ +--- +title: 推送通知 +sidebar_position: 13 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/14.Eligible Check.md b/packages/artplayer-document/docs/zh-cn/Basic Services/14.Eligible Check.md new file mode 100644 index 000000000..c008ed653 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/14.Eligible Check.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 14 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/15.Get the token for uploading image.md b/packages/artplayer-document/docs/zh-cn/Basic Services/15.Get the token for uploading image.md new file mode 100644 index 000000000..9095cc478 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/15.Get the token for uploading image.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 15 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/16.Upload Image - By sending file stream.md b/packages/artplayer-document/docs/zh-cn/Basic Services/16.Upload Image - By sending file stream.md new file mode 100644 index 000000000..cd77a8173 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/16.Upload Image - By sending file stream.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 16 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/17.Upload Image - By using base64 or url format.md b/packages/artplayer-document/docs/zh-cn/Basic Services/17.Upload Image - By using base64 or url format.md new file mode 100644 index 000000000..7ea4b7053 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/17.Upload Image - By using base64 or url format.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 17 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/18.Get the redirect url.md b/packages/artplayer-document/docs/zh-cn/Basic Services/18.Get the redirect url.md new file mode 100644 index 000000000..973ce7047 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/18.Get the redirect url.md @@ -0,0 +1,3 @@ +--- +sidebar_position: 18 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/2.Authorization list inquiry.md b/packages/artplayer-document/docs/zh-cn/Basic Services/2.Authorization list inquiry.md new file mode 100644 index 000000000..6612d62ee --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/2.Authorization list inquiry.md @@ -0,0 +1,4 @@ +--- +title: 查询授权列表 +sidebar_position: 2 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/3.Get the authorization detail page.md b/packages/artplayer-document/docs/zh-cn/Basic Services/3.Get the authorization detail page.md new file mode 100644 index 000000000..ccabc4507 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/3.Get the authorization detail page.md @@ -0,0 +1,4 @@ +--- +title: 获取授权地址 +sidebar_position: 3 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/4.Call back for authorization status.md b/packages/artplayer-document/docs/zh-cn/Basic Services/4.Call back for authorization status.md new file mode 100644 index 000000000..42d190387 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/4.Call back for authorization status.md @@ -0,0 +1,4 @@ +--- +title: 授权回调通知 +sidebar_position: 4 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/5.Bank card inquiry.md b/packages/artplayer-document/docs/zh-cn/Basic Services/5.Bank card inquiry.md new file mode 100644 index 000000000..9f98cde4b --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/5.Bank card inquiry.md @@ -0,0 +1,4 @@ +--- +title: 绑卡信息查询 +sidebar_position: 5 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/6.Get bank list.md b/packages/artplayer-document/docs/zh-cn/Basic Services/6.Get bank list.md new file mode 100644 index 000000000..c28d7e73b --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/6.Get bank list.md @@ -0,0 +1,4 @@ +--- +title: 银行列表查询 +sidebar_position: 6 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/7.Bank card verification.md b/packages/artplayer-document/docs/zh-cn/Basic Services/7.Bank card verification.md new file mode 100644 index 000000000..8e6093e4f --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/7.Bank card verification.md @@ -0,0 +1,4 @@ +--- +title: 绑定银行卡 +sidebar_position: 7 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/8.Submit loan.md b/packages/artplayer-document/docs/zh-cn/Basic Services/8.Submit loan.md new file mode 100644 index 000000000..6843de236 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/8.Submit loan.md @@ -0,0 +1,4 @@ +--- +title: 申请借款 +sidebar_position: 8 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/9.Loan agreement inquiry.md b/packages/artplayer-document/docs/zh-cn/Basic Services/9.Loan agreement inquiry.md new file mode 100644 index 000000000..b61844f7f --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/9.Loan agreement inquiry.md @@ -0,0 +1,4 @@ +--- +title: 查看合同 +sidebar_position: 9 +--- diff --git a/packages/artplayer-document/docs/zh-cn/Basic Services/_category_.json b/packages/artplayer-document/docs/zh-cn/Basic Services/_category_.json new file mode 100644 index 000000000..b854c06c2 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Basic Services/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "基本接口", + "position": 5, + "collapsed": false +} diff --git a/packages/artplayer-document/docs/zh-cn/Data dictionary.md b/packages/artplayer-document/docs/zh-cn/Data dictionary.md new file mode 100644 index 000000000..e0c57037f --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Data dictionary.md @@ -0,0 +1,195 @@ +--- +title: 数据字典 +sidebar_position: 4 +--- + +## 婚姻状况 + +| 编码 | 描述 | 备注 | +| ---- | ------------- | ---- | +| 10 | Belum Menikah | | +| 11 | Menikah | | +| 12 | Cerai | | + +## 教育程度 + +| 编码 | 描述 | 备注 | +| ---- | ------------------ | ---- | +| 14 | Sekolah Dasar | | +| 16 | SMP | | +| 13 | SMA | | +| 15 | Diploma/Politehnik | | +| 10 | Sarjana | | +| 11 | Master | | +| 12 | Doctor | | +| 17 | Lain-Lain | | + +## 宅所有权 + +| 编码 | 描述 | 备注 | +| ---- | -------------- | ---- | +| 10 | Rumah Sendiri | | +| 11 | Rumah Keluarga | | +| 12 | Rumah Dinas | | +| 13 | Sewa/Kontrak | | +| 14 | Kost | | +| 15 | Status Kredit | | +| 16 | Lain-Lain | | + +## 宗教 + +| 编码 | 描述 | 备注 | +| ---- | ----------------- | ---- | +| 10 | Islam | | +| 11 | Kristen Protestan | | +| 12 | Kristen Katolik | | +| 13 | Hindu | | +| 14 | Budha | | +| 15 | Kong Hu Cu | | + +## 工作类型 + +| 编码 | 描述 | 备注 | +| ---- | ------------- | ---- | +| 10 | Tetap | | +| 11 | Kontrak | | +| 12 | Outsourcing | | +| 13 | Pekerja Lepas | | +| 14 | Pemilik Usaha | | + +## 职位 + +| 编码 | 描述 | 备注 | +| ---- | ------------------------ | ---- | +| 10 | Direktur/General Manager | | +| 11 | Manajer | | +| 12 | Asisten Manajer | | +| 13 | Staf | | +| 14 | Pemilik | | + +## 行业 + +| 编码 | 描述 | 备注 | +| ---- | ------------------------------------------- | ---- | +| 10 | Perdagangan Eceran / Grosir | | +| 11 | Perbankan / Keuangan / Asuransi / Investasi | | +| 12 | Manufaktur | | +| 13 | Properti / Konstruksi | | +| 14 | Pertambangan / Minyak / Gas | | +| 15 | Pendidikan | | +| 16 | Telekomunikasi | | +| 17 | Pariwisata / Hotel / Perhotelan | | +| 18 | Angkutan | | +| 19 | PNS (Pemerintah) | | +| 20 | Konsultan / Akuntansi / Jasa Profesional | | +| 21 | BUMN (Badan Usaha Milik Negara) | | +| 22 | Perkebunan / Pertanian | | +| 23 | TNI / Polisi (Militer / Polisi) | | +| 24 | Hukum | | +| 25 | Teknologi | | +| 26 | Media / Hiburan | | +| 27 | Pemasaran iklan | | +| 28 | Makanan & Minuman | | +| 29 | Layanan medis | | +| 30 | Perikanan | | + +## 办公场所所有权 + +| 编码 | 描述 | 备注 | +| ---- | ------------- | ---- | +| 10 | Milik Sendiri | | +| 11 | Sewa | | + +## 公司人数 + +| 编码 | 描述 | 备注 | +| ---- | ----- | ---- | +| 10 | 1-5 | | +| 11 | 5-10 | | +| 12 | 10-25 | | +| 13 | 25-50 | | +| 14 | >50 | | + +## 职业 + +| 编码 | 描述 | 备注 | +| ---- | ------------------------- | ---- | +| 11 | Pensiunan/Purnawirawan | | +| 12 | Pelayaran/Pelaut | | +| 13 | Guru/Pendidikan | | +| 14 | Jasa | | +| 15 | Dokter/Bidan/Mantri | | +| 16 | Ojek Motor | | +| 17 | Sopir | | +| 18 | Peternak | | +| 19 | Pelajar/Mahasiswa | | +| 20 | Buruh/PRT | | +| 21 | Pengrajin Tangan | | +| 23 | Pedagang | | +| 24 | Produksi | | +| 26 | Sewa/Rent | | +| 27 | Transportasi & Komunikasi | | +| 28 | Hiburan | | +| 29 | Pendidikan Non Formal | | +| 30 | Hotel | | +| 31 | Perangkat Desa | | +| 32 | TNI/Polri | | +| 33 | Atlet | | +| 34 | Pengobatan Alternatif | | +| 2 | ABRI | | +| 3 | Pengacara | | +| 35 | Jurnalis / Wartawan | | +| 37 | Profesi | | +| 36 | Wartawan | | +| 6 | Lain-Lain | | +| 38 | Pekerja Lepas | | + +## 收入来源 + +| 编码 | 描述 | 备注 | +| ---- | ---------------------------------- | ---- | +| 10 | Gaji/Upah | | +| 11 | Laba Usaha | | +| 12 | Uang Tabungan | | +| 13 | Menjual/Menggadaikan Aset | | +| 14 | Dari Keluarga/Teman/Sumber Lainnya | | + +## 紧急联系人关系 + +| 编码 | 描述 | 备注 | +| ---- | --------------- | ---- | +| 10 | Pasangan | | +| 11 | Orang Tua | | +| 12 | Saudara Kandung | | +| 13 | Anak | | +| 14 | Teman Kantor | | + +## 借款原因 + +| 编码 | 描述 | 备注 | +| ---- | ----------------------------------------- | ---- | +| 10 | Pembelian Handphone / Laptop / Elektronik | | +| 11 | Tagihan Rutin | | +| 12 | Liburan / Rekreasi | | +| 13 | Pembayaran Pajak | | +| 14 | Asuransi | | +| 15 | Pengobatan Medis | | +| 16 | Pendidikan | | +| 17 | Konsumsi Rumah Tangga | | +| 18 | Modal Usaha | | +| 19 | Multiguna | | + +## 文档类型 + +| 编码 | 描述 | 备注 | +| ----------------------- | ------------------------------------ | ---- | +| bank_statement_3_months | Bank statement for the last 3 months | | +| company_id_card | | | +| ID_PNS | | | +| receiptri | | | +| salary_certificate | | | +| salary_slip_3_months | Salary slip for the last 3 months | | +| self_SKU_SIUP_TDP | | | +| SK_PNS | | | +| driver_license | | | +| KTP | | | \ No newline at end of file diff --git a/packages/artplayer-document/docs/zh-cn/Overview.md b/packages/artplayer-document/docs/zh-cn/Overview.md new file mode 100644 index 000000000..f41bb0866 --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Overview.md @@ -0,0 +1,80 @@ +--- +title: 前言 +sidebar_position: 1 +slug: /zh-cn +--- + +## 必读 + +- 在生产环境发布前前,请先通过测试环境调试完所有接口及流程后待我方确认无误方可上生产环境 + +- 在开发过程中,可以使用接口调试工具来在线调试某些接口。 + +- 在开发出现问题时,可以通过接口调用的返回码查看失败原因或联系我方技术支持人员 + +- 所有接口都采用POST方式(包括查询接口) + +- 请求和响应的数据都为JSON格式。注:请设置Header的Content-Type为application/json,采用UTF-8字符编码 + +- 所有的接口必须进行接口签名 + +## 更新日志 + +| 版本 | 日期 | 项目负责人 | 描述 | +| ------- | ---------- | ------- | ------- | +| 1.0.0 | 2019.06.03 | 吕志博 | 初始版本 | + +## 接口说明 + +| **接口名称** | **描述** | +| -----------------| --------------- | +| user registration|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 用户创建,必须先创建用户成功后才能调用其他接口

| +| Authorization list inquiry|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 否

接口描述 : 获取授权列表及用户个人授权状态

| +| Get the authorization detail page|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 否

接口描述 : 授权第三方授权页面地址

+| Call back for authorization status|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 否

接口描述 : 通知授权结果

| +| Bank card inquiry|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 查询绑卡信息

| +| Get bank list|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 获取支持绑卡的银行列表

| +| Bank card verification|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 用户绑定用于接收平台放款的银行卡

| +| Submit loan|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 提交进件信息,进件信息包含(用户个人信息、身份信息、工作信息、紧急联系人信息)

| +| Loan agreement inquiry|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 查看贷款合同

| +| Sign agreement|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 合同签约(确认放款)

| +| Get loan information|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 根据贷款编号查询贷款当前信息(如已放款则包含还款计划)

| +| Get repayment VA|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : 用户还款虚拟账号查询

| +| Push notification|

Provider: Third party

User : AWDA

是否必须对接: 否

接口描述 : 推送贷款状态变更消息

| +| Eligible Check|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 是

接口描述 : Verify Customer

| +| Get the token for uploading image|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 否

接口描述 : To get the token which used for api Upload Image (1)

| +| Upload Image (1)|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 否

接口描述 : By sending file stream with token

| +| Upload Image (2)|

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 否

接口描述 : By sending base64 or url format

| +| Get the redirect url
(For H5 pages of Digital Signature, Loan detail and Repayment detail) |

接口提供方: AWDA

接口调用方 : 合作方

是否必须对接 : 否

接口描述 : Redirect to the specific H5 pages

| + +## 环境地址说明 + +测试环境域名:`https://sea-staging.wolaidai.com` + +生产环境域名:`https://japi.maucash.id` + +注:所有接口调用真实地址为 `环境域名+接口地址` + +## 全局状态码说明 + +| 返回码| 描述| +| ----|----| +| 0 |请求成功| +| 100| 系统繁忙| +| 300| 请求超时| +| 400| 参数错误| +| 404| 网络异常| +| 600| 数据不存在| +| 999| 其他未知错误| +| 1001| 重复请求| +| 1002| 无效的token| +| 1003| 时间戳有误或已失效(仅处理60S内的请求)| +| 1004| 签名校验不通过| +| 1005| 商户号错误| +| 1006| 参数不能为空| +| 1007| 参数有误| +| 1008| 用户已存在| +| 1009| 用户不存在| +| 1010| 订单不存在| +| 1011| 系统繁忙| +| 1012| 授权信息获取失败| \ No newline at end of file diff --git a/packages/artplayer-document/docs/zh-cn/Parameters Instructions.md b/packages/artplayer-document/docs/zh-cn/Parameters Instructions.md new file mode 100644 index 000000000..4f4c7500d --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/Parameters Instructions.md @@ -0,0 +1,100 @@ +--- +title: 入参及出参说明 +sidebar_position: 3 +--- + +### API请求参数说明 + +:::note +注:所有的API接口都包含如下参数(不同的接口只是参数body值不一样),以下具体接口只针对body进行描述若接口,当没有业务参数的时候, body需要赋值为空字符串,即body: "" +::: + +| 参数名称 | 描述 | 类型 | 必填 | 备注 | +| --------- | --------------- | ------ | ---- | -------------------- | +| body | 业务参数 | Object | 否 | 具体接口决定是否必传 | +| timestamp | 时间戳 | Long | 是 | 精确到秒 | +| appId | 平台分配的appId | String | 是 | +| v | 接口版本号 | String | 否 | 默认1.0 | +| signature | 签名 | String | 是 | 见签名生成 | + +例: + +```json +{ + "body": "1111", + "timestamp": 1488363493, + "signature": "B3C14758F4AF52AE8AA0D4CD1493B137", + "appId": "111", + "v":"1.0" +} +``` + +### 接口签名规则 + +签名生成的通用步骤如下: + +- 第一步:将参与签名的参数按照键值(key)进行字典排序 +- 第二步:将排序过后的参数,进行key和value字符串拼接 +- 第三步:将拼接后的字符串末尾加上secret秘钥,合成签名字符串 +- 第四步:对签名字符串进行MD5加密,生成32位的字符串转换为大写 + +### 签名生成过程 + +第一步:将参与签名的参数按照键值(key)进行字典排序 + +例如:将上述请求参数中的body、timestamp、appId、v 进行字典排序。结果为:appId、body、timestamp (精确到秒)、v + +第二步:将排序过后的参数,进行key和value字符串拼接 + +将参数中的key和value按照key的顺序进行字符串拼接。若body为对象的话转成JSON字符串进行签名即可 + +例:appId:123456body:{"orderNo":"1234567"}timestamp:1558923813v:1.0 + +第三步:将拼接后的字符串尾部加上secret秘钥,合成签名字符串 + +将第二步的字符窜首尾拼接上secret。结果为:appId:123456body:{"orderNo":"1234567"}timestamp:1558923813v:1.0yousecret + +第四步:对签名字符串进行MD5加密,生成32位的字符串,并转换大写 + +对生成签名字符串进行MD5加密。结果为:B6F6E3F9ADF4D7558F54BC8B7D9869CC + +### Java 签名代码 + +```java +String[] keys = new String[map.size()]; +int i = 0; +for (Map.Entry entry : map.entrySet()) { + keys[i++] = entry.getKey(); +} +Arrays.sort(keys); +StringBuilder stringBuilder = new StringBuilder(); +for (String key : keys) { + stringBuilder.append(key); + stringBuilder.append(":"); + stringBuilder.append(map.get(key)); +} +stringBuilder.append(secret); +String str=stringBuilder.toString(); +String encodeStr = DigestUtils.md5Hex(str).toUpperCase(); +return encodeStr ; +``` + +### API响应结果说明 + +| 参数名称 | 描述 | 类型 | 必填 | 备注 | +| -------- | -------- | ------- | ---- | --------------------------------------------------- | +| code | 状态码 | Integer | 是 |

0:执行成功

其他编码均为失败,详见码表

| +| message | 状态描述 | String | 是 | 用于描述code | +| result | 详细信息 | Object | 否 | 当code为0时 result为返回的业务数据。 | + +正确响应的JSON - 例: + +```json +{ + "code": 0, + "message": "Permintaan berhasil", + "result": { + "state": true + } +} +``` \ No newline at end of file diff --git a/packages/artplayer-document/docs/zh-cn/UML Diagram.md b/packages/artplayer-document/docs/zh-cn/UML Diagram.md new file mode 100644 index 000000000..ad54c20ce --- /dev/null +++ b/packages/artplayer-document/docs/zh-cn/UML Diagram.md @@ -0,0 +1,24 @@ +--- +title: 参考对接UML时序图 +sidebar_position: 2 +--- + +### Wedefend授权 + +![logo](/img/Authorization.png) + +### 绑定银行卡 + +![logo](/img/SubmitBankCard.png) + +### 申请借款 + +![logo](/img/ApplyForLloan.png) + +### 合同签约 + +![logo](/img/ContractContract.png) + +### 还款信息 + +![logo](/img/RepaymentInformation.png) \ No newline at end of file diff --git a/packages/artplayer-document/docusaurus.config.js b/packages/artplayer-document/docusaurus.config.js index abef4eec9..dd7ed5aca 100644 --- a/packages/artplayer-document/docusaurus.config.js +++ b/packages/artplayer-document/docusaurus.config.js @@ -1,106 +1,84 @@ const lightCodeTheme = require('prism-react-renderer/themes/github'); const darkCodeTheme = require('prism-react-renderer/themes/dracula'); -const config = { - title: 'Artplayer.js Document', - tagline: 'ArtPlayer.js is an modern and full featured HTML5 video player', +module.exports = { + title: 'Artplayer.js', + tagline: 'Public Product Api Document', url: 'https://artplayer.org', baseUrl: '/document/', onBrokenLinks: 'ignore', onBrokenMarkdownLinks: 'ignore', favicon: 'img/favicon.ico', - organizationName: 'zhw2590582', - projectName: 'artplayer', - presets: [ - [ - '@docusaurus/preset-classic', - { - docs: { - sidebarPath: require.resolve('./sidebars.js'), - editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/', - }, - blog: { - showReadingTime: true, - editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/blog/', - }, - theme: { - customCss: require.resolve('./src/css/custom.css'), - }, - }, - ], - ], + clientModules: [require.resolve('./src/script/main.js')], themeConfig: { + hideableSidebar: true, navbar: { - title: 'My Site', - logo: { - alt: 'My Site Logo', - src: 'img/logo.svg', - }, + title: 'Artplayer.js', items: [ { - type: 'doc', - docId: 'intro', + href: 'https://artplayer.org', position: 'left', - label: 'Tutorial', + label: 'Online Editor', }, - { to: '/blog', label: 'Blog', position: 'left' }, { - href: 'https://github.com/facebook/docusaurus', - label: 'GitHub', + href: 'https://github.com/zhw2590582/ArtPlayer', + position: 'left', + label: 'Github', + }, + { + label: 'QQ群: 320881312', position: 'right', }, + { + label: 'v 4.x.x', + position: 'right', + items: [ + { + label: 'v 3.x.x', + href: 'https://artplayer.org/document_v3/', + }, + ], + }, + { + label: 'English', + position: 'right', + items: [ + { + label: 'English', + href: '/', + }, + { + label: '中文', + href: '/zh-cn/', + }, + ], + }, ], }, footer: { style: 'dark', - links: [ - { - title: 'Docs', - items: [ - { - label: 'Tutorial', - to: '/docs/intro', - }, - ], - }, - { - title: 'Community', - items: [ - { - label: 'Stack Overflow', - href: 'https://stackoverflow.com/questions/tagged/docusaurus', - }, - { - label: 'Discord', - href: 'https://discordapp.com/invite/docusaurus', - }, - { - label: 'Twitter', - href: 'https://twitter.com/docusaurus', - }, - ], - }, - { - title: 'More', - items: [ - { - label: 'Blog', - to: '/blog', - }, - { - label: 'GitHub', - href: 'https://github.com/facebook/docusaurus', - }, - ], - }, - ], - copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, + copyright: `Copyright © ${new Date().getFullYear()} Artplayer.js, Inc. Built with Docusaurus.`, }, prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme, }, }, + plugins: [require.resolve('docusaurus-lunr-search')], + presets: [ + [ + '@docusaurus/preset-classic', + { + docs: { + path: './docs', + routeBasePath: '/', + sidebarPath: require.resolve('./sidebars.js'), + }, + blog: false, + theme: { + customCss: require.resolve('./src/css/custom.css'), + }, + }, + ], + ], }; - -module.exports = config; diff --git a/packages/artplayer-document/package.json b/packages/artplayer-document/package.json index 4a3c461e7..941e57204 100644 --- a/packages/artplayer-document/package.json +++ b/packages/artplayer-document/package.json @@ -1,23 +1,25 @@ { "name": "artplayer-document", - "version": "4.0.0", + "version": "1.0.0", + "private": true, "scripts": { "docusaurus": "docusaurus", - "start": "docusaurus start", - "build": "docusaurus build", - "swizzle": "docusaurus swizzle", - "deploy": "docusaurus deploy", - "clear": "docusaurus clear", - "serve": "docusaurus serve", - "write-translations": "docusaurus write-translations", - "write-heading-ids": "docusaurus write-heading-ids" + "start": "npx docusaurus start", + "build": "npx docusaurus build", + "swizzle": "npx docusaurus swizzle", + "deploy": "npx docusaurus deploy", + "clear": "npx docusaurus clear", + "serve": "npx docusaurus serve", + "write-translations": "npx docusaurus write-translations", + "write-heading-ids": "npx docusaurus write-heading-ids" }, "dependencies": { - "@docusaurus/core": "2.0.0-beta.9", - "@docusaurus/preset-classic": "2.0.0-beta.9", + "@docusaurus/core": "2.0.0-beta.3", + "@docusaurus/preset-classic": "2.0.0-beta.3", "@mdx-js/react": "^1.6.21", "@svgr/webpack": "^5.5.0", "clsx": "^1.1.1", + "docusaurus-lunr-search": "^2.1.14", "file-loader": "^6.2.0", "prism-react-renderer": "^1.2.1", "react": "^17.0.1", @@ -36,4 +38,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/packages/artplayer-document/sidebars.js b/packages/artplayer-document/sidebars.js index fd342f2cd..25226f070 100644 --- a/packages/artplayer-document/sidebars.js +++ b/packages/artplayer-document/sidebars.js @@ -1,31 +1,4 @@ -/** - * Creating a sidebar enables you to: - - create an ordered group of docs - - render a sidebar for each doc of that group - - provide next/previous navigation - - The sidebars can be generated from the filesystem, or explicitly defined here. - - Create as many sidebars as you want. - */ - -// @ts-check - -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const sidebars = { - // By default, Docusaurus generates a sidebar from the docs folder structure - tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], - - // But you can create a sidebar manually - /* - tutorialSidebar: [ - { - type: 'category', - label: 'Tutorial', - items: ['hello'], - }, - ], - */ +module.exports = { + en: [{ type: "autogenerated", dirName: "en" }], + "zh-cn": [{ type: "autogenerated", dirName: "zh-cn" }], }; - -module.exports = sidebars; diff --git a/packages/artplayer-document/src/components/HomepageFeatures.js b/packages/artplayer-document/src/components/HomepageFeatures.js deleted file mode 100644 index 16f820b10..000000000 --- a/packages/artplayer-document/src/components/HomepageFeatures.js +++ /dev/null @@ -1,64 +0,0 @@ -import React from 'react'; -import clsx from 'clsx'; -import styles from './HomepageFeatures.module.css'; - -const FeatureList = [ - { - title: 'Easy to Use', - Svg: require('../../static/img/undraw_docusaurus_mountain.svg').default, - description: ( - <> - Docusaurus was designed from the ground up to be easily installed and - used to get your website up and running quickly. - - ), - }, - { - title: 'Focus on What Matters', - Svg: require('../../static/img/undraw_docusaurus_tree.svg').default, - description: ( - <> - Docusaurus lets you focus on your docs, and we'll do the chores. Go - ahead and move your docs into the docs directory. - - ), - }, - { - title: 'Powered by React', - Svg: require('../../static/img/undraw_docusaurus_react.svg').default, - description: ( - <> - Extend or customize your website layout by reusing React. Docusaurus can - be extended while reusing the same header and footer. - - ), - }, -]; - -function Feature({Svg, title, description}) { - return ( -
-
- -
-
-

{title}

-

{description}

-
-
- ); -} - -export default function HomepageFeatures() { - return ( -
-
-
- {FeatureList.map((props, idx) => ( - - ))} -
-
-
- ); -} diff --git a/packages/artplayer-document/src/components/HomepageFeatures.module.css b/packages/artplayer-document/src/components/HomepageFeatures.module.css deleted file mode 100644 index b248eb2e5..000000000 --- a/packages/artplayer-document/src/components/HomepageFeatures.module.css +++ /dev/null @@ -1,11 +0,0 @@ -.features { - display: flex; - align-items: center; - padding: 2rem 0; - width: 100%; -} - -.featureSvg { - height: 200px; - width: 200px; -} diff --git a/packages/artplayer-document/src/css/custom.css b/packages/artplayer-document/src/css/custom.css index 6abe14854..29d8472dd 100644 --- a/packages/artplayer-document/src/css/custom.css +++ b/packages/artplayer-document/src/css/custom.css @@ -1,3 +1,4 @@ +/* stylelint-disable docusaurus/copyright-header */ /** * Any CSS included here will be global. The classic template * bundles Infima by default. Infima is a CSS framework designed to @@ -23,6 +24,37 @@ padding: 0 var(--ifm-pre-padding); } -html[data-theme='dark'] .docusaurus-highlight-code-line { +html[data-theme="dark"] .docusaurus-highlight-code-line { background-color: rgba(0, 0, 0, 0.3); } + +table { + display: table; + font-size: 15px; +} + +table th { + text-align: left; +} + +table thead tr { + border-bottom-width: 1px !important; +} + +table p { + margin-bottom: 0px; +} + +.markdown li > p { + margin-top: 10px; + margin-bottom: 10px; +} + +.markdown > p { + margin-bottom: 10px; +} + +.navbar__search { + padding-left: 1rem; + padding-left: var(--ifm-navbar-padding-horizontal); +} diff --git a/packages/artplayer-document/src/pages/index.js b/packages/artplayer-document/src/pages/index.js deleted file mode 100644 index 27c21e8f9..000000000 --- a/packages/artplayer-document/src/pages/index.js +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; -import clsx from 'clsx'; -import Layout from '@theme/Layout'; -import Link from '@docusaurus/Link'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import styles from './index.module.css'; -import HomepageFeatures from '../components/HomepageFeatures'; - -function HomepageHeader() { - const {siteConfig} = useDocusaurusContext(); - return ( -
-
-

{siteConfig.title}

-

{siteConfig.tagline}

-
- - Docusaurus Tutorial - 5min ⏱️ - -
-
-
- ); -} - -export default function Home() { - const {siteConfig} = useDocusaurusContext(); - return ( - - -
- -
-
- ); -} diff --git a/packages/artplayer-document/src/pages/index.module.css b/packages/artplayer-document/src/pages/index.module.css deleted file mode 100644 index 666feb6a1..000000000 --- a/packages/artplayer-document/src/pages/index.module.css +++ /dev/null @@ -1,23 +0,0 @@ -/** - * CSS files with the .module.css suffix will be treated as CSS modules - * and scoped locally. - */ - -.heroBanner { - padding: 4rem 0; - text-align: center; - position: relative; - overflow: hidden; -} - -@media screen and (max-width: 966px) { - .heroBanner { - padding: 2rem; - } -} - -.buttons { - display: flex; - align-items: center; - justify-content: center; -} diff --git a/packages/artplayer-document/src/pages/markdown-page.md b/packages/artplayer-document/src/pages/markdown-page.md deleted file mode 100644 index 9756c5b66..000000000 --- a/packages/artplayer-document/src/pages/markdown-page.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Markdown page example ---- - -# Markdown page example - -You don't need React to write simple standalone pages. diff --git a/packages/artplayer-document/src/script/bugfix.js b/packages/artplayer-document/src/script/bugfix.js new file mode 100644 index 000000000..553eff901 --- /dev/null +++ b/packages/artplayer-document/src/script/bugfix.js @@ -0,0 +1,36 @@ +const i18n = { + English: "中文", +}; + +function changeI18n() { + const zh = window.location.pathname.startsWith("/zh-cn/"); + const links = Array.from(document.querySelectorAll(".navbar__link")); + links.forEach((item) => { + const text = item.textContent.trim(); + if (zh) { + if (i18n[text]) { + item.textContent = i18n[text]; + item.dataset.en = text; + } + } else { + if (item.dataset.en && item.dataset.en !== text) { + item.textContent = item.dataset.en; + } + } + }); +} + +window.addEventListener("load", () => { + setTimeout(changeI18n, 300); + document.addEventListener("click", (event) => { + const { className } = event.target; + if (!className || typeof className !== "string") return; + if ( + className.includes("navbar__link") || + className.includes("dropdown__link") || + className.includes("navbar__title") + ) { + setTimeout(changeI18n, 300); + } + }); +}); diff --git a/packages/artplayer-document/src/script/main.js b/packages/artplayer-document/src/script/main.js new file mode 100644 index 000000000..e9183aa00 --- /dev/null +++ b/packages/artplayer-document/src/script/main.js @@ -0,0 +1,3 @@ +if (typeof window !== "undefined") { + require("./bugfix"); +} diff --git a/packages/artplayer-document/src/theme/SearchBar/algolia.css b/packages/artplayer-document/src/theme/SearchBar/algolia.css new file mode 100644 index 000000000..8f3038edc --- /dev/null +++ b/packages/artplayer-document/src/theme/SearchBar/algolia.css @@ -0,0 +1,533 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* Bottom border of each suggestion */ +.algolia-docsearch-suggestion { + border-bottom-color: #3a3dd1; +} +/* Main category headers */ +.algolia-docsearch-suggestion--category-header { + background-color: #4b54de; +} +/* Highlighted search terms */ +.algolia-docsearch-suggestion--highlight { + color: #3a33d1; +} +/* Highligted search terms in the main category headers */ +.algolia-docsearch-suggestion--category-header + .algolia-docsearch-suggestion--highlight { + background-color: #4d47d5; +} +/* Currently selected suggestion */ +.aa-cursor .algolia-docsearch-suggestion--content { + color: #272296; +} +.aa-cursor .algolia-docsearch-suggestion { + background: #ebebfb; +} + +/* For bigger screens, when displaying results in two columns */ +@media (min-width: 768px) { + /* Bottom border of each suggestion */ + .algolia-docsearch-suggestion { + border-bottom-color: #7671df; + } + /* Left column, with secondary category header */ + .algolia-docsearch-suggestion--subcategory-column { + border-right-color: #7671df; + color: #4e4726; + } +} + +.searchbox { + display: inline-block; + position: relative; + width: 200px; + height: 32px !important; + white-space: nowrap; + box-sizing: border-box; + visibility: visible !important; +} + +.searchbox .algolia-autocomplete { + display: block; + width: 100%; + height: 100%; +} + +.searchbox__wrapper { + width: 100%; + height: 100%; + z-index: 999; + position: relative; +} + +.searchbox__input { + display: inline-block; + box-sizing: border-box; + -webkit-transition: box-shadow 0.4s ease, background 0.4s ease; + transition: box-shadow 0.4s ease, background 0.4s ease; + border: 0; + border-radius: 16px; + box-shadow: inset 0 0 0 1px #cccccc; + background: #ffffff !important; + padding: 0; + padding-right: 26px; + padding-left: 32px; + width: 100%; + height: 100%; + vertical-align: middle; + white-space: normal; + font-size: 12px; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.searchbox__input::-webkit-search-decoration, +.searchbox__input::-webkit-search-cancel-button, +.searchbox__input::-webkit-search-results-button, +.searchbox__input::-webkit-search-results-decoration { + display: none; +} + +.searchbox__input:hover { + box-shadow: inset 0 0 0 1px #b3b3b3; +} + +.searchbox__input:focus, +.searchbox__input:active { + outline: 0; + box-shadow: inset 0 0 0 1px #aaaaaa; + background: #ffffff; +} + +.searchbox__input::-webkit-input-placeholder { + color: #aaaaaa; +} + +.searchbox__input::-moz-placeholder { + color: #aaaaaa; +} + +.searchbox__input:-ms-input-placeholder { + color: #aaaaaa; +} + +.searchbox__input::placeholder { + color: #aaaaaa; +} + +.searchbox__submit { + position: absolute; + top: 0; + margin: 0; + border: 0; + border-radius: 16px 0 0 16px; + background-color: rgba(69, 142, 225, 0); + padding: 0; + width: 32px; + height: 100%; + vertical-align: middle; + text-align: center; + font-size: inherit; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + right: inherit; + left: 0; +} + +.searchbox__submit::before { + display: inline-block; + margin-right: -4px; + height: 100%; + vertical-align: middle; + content: ''; +} + +.searchbox__submit:hover, +.searchbox__submit:active { + cursor: pointer; +} + +.searchbox__submit:focus { + outline: 0; +} + +.searchbox__submit svg { + width: 14px; + height: 14px; + vertical-align: middle; + fill: #6d7e96; +} + +.searchbox__reset { + display: block; + position: absolute; + top: 8px; + right: 8px; + margin: 0; + border: 0; + background: none; + cursor: pointer; + padding: 0; + font-size: inherit; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + fill: rgba(0, 0, 0, 0.5); +} + +.searchbox__reset.hide { + display: none; +} + +.searchbox__reset:focus { + outline: 0; +} + +.searchbox__reset svg { + display: block; + margin: 4px; + width: 8px; + height: 8px; +} + +.searchbox__input:valid ~ .searchbox__reset { + display: block; + -webkit-animation-name: sbx-reset-in; + animation-name: sbx-reset-in; + -webkit-animation-duration: 0.15s; + animation-duration: 0.15s; +} + +@-webkit-keyframes sbx-reset-in { + 0% { + -webkit-transform: translate3d(-20%, 0, 0); + transform: translate3d(-20%, 0, 0); + opacity: 0; + } + 100% { + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +@keyframes sbx-reset-in { + 0% { + -webkit-transform: translate3d(-20%, 0, 0); + transform: translate3d(-20%, 0, 0); + opacity: 0; + } + 100% { + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +.algolia-autocomplete .ds-dropdown-menu:before { + display: block; + position: absolute; + content: ''; + width: 14px; + height: 14px; + background: #373940; + z-index: 1000; + top: -7px; + border-top: 1px solid #373940; + border-right: 1px solid #373940; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + border-radius: 2px; +} + +.algolia-autocomplete .ds-dropdown-menu { + box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.2), 0 2px 3px 0 rgba(0, 0, 0, 0.1); +} + +@media (min-width: 601px) { + .algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu { + right: 0 !important; + left: inherit !important; + } + + .algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu:before { + right: 48px; + } + + .algolia-autocomplete .ds-dropdown-menu { + position: relative; + top: -6px; + border-radius: 4px; + margin: 6px 0 0; + padding: 0; + text-align: left; + height: auto; + position: relative; + background: transparent; + border: none; + z-index: 999; + max-width: 600px; + min-width: 500px; + } +} + +@media (max-width: 600px) { + .algolia-autocomplete .ds-dropdown-menu { + z-index: 100; + position: fixed !important; + top: 50px !important; + left: auto !important; + right: 1rem !important; + width: 600px; + max-width: calc(100% - 2rem); + max-height: calc(100% - 5rem); + display: block; + } + + .algolia-autocomplete .ds-dropdown-menu:before { + right: 6rem; + } +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + position: relative; + z-index: 1000; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestion { + cursor: pointer; +} + +.algolia-autocomplete .ds-dropdown-menu [class^='ds-dataset-'] { + position: relative; + border-radius: 4px; + overflow: auto; + padding: 0; + background: #ffffff; +} + +.algolia-autocomplete .ds-dropdown-menu * { + box-sizing: border-box; +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + display: block; + position: relative; + padding: 0; + overflow: hidden; + text-decoration: none; +} + +.algolia-autocomplete .ds-cursor .algolia-docsearch-suggestion--wrapper { + background: #f1f1f1; + box-shadow: inset -2px 0 0 #61dafb; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + background: #ffe564; + padding: 0.1em 0.05em; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion--category-header + .algolia-docsearch-suggestion--category-header-lvl0 + .algolia-docsearch-suggestion--highlight, +.algolia-autocomplete + .algolia-docsearch-suggestion--category-header + .algolia-docsearch-suggestion--category-header-lvl1 + .algolia-docsearch-suggestion--highlight { + color: inherit; + background: inherit; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion--text + .algolia-docsearch-suggestion--highlight { + padding: 0 0 1px; + background: inherit; + box-shadow: inset 0 -2px 0 0 rgba(69, 142, 225, 0.8); + color: inherit; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + display: block; + float: right; + width: 70%; + position: relative; + padding: 5.33333px 0 5.33333px 10.66667px; + cursor: pointer; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content:before { + content: ''; + position: absolute; + display: block; + top: 0; + height: 100%; + width: 1px; + background: #ececec; + left: -1px; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + position: relative; + display: none; + font-size: 14px; + letter-spacing: 0.08em; + font-weight: 700; + background-color: #373940; + text-transform: uppercase; + color: #fff; + margin: 0; + padding: 5px 8px; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + background-color: #fff; + width: 100%; + float: left; + padding: 8px 0 0 0; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: left; + width: 30%; + display: none; + padding-left: 0; + text-align: right; + position: relative; + padding: 5.33333px 10.66667px; + color: #777; + font-size: 0.9em; + word-wrap: break-word; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column:before { + content: ''; + position: absolute; + display: block; + top: 0; + height: 100%; + width: 1px; + background: #ececec; + right: 0; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main + .algolia-docsearch-suggestion--category-header, +.algolia-autocomplete + .algolia-docsearch-suggestion.algolia-docsearch-suggestion__secondary { + display: block; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion--subcategory-column + .algolia-docsearch-suggestion--highlight { + background-color: inherit; + color: inherit; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-inline { + display: none; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + margin-bottom: 4px; + color: #02060c; + font-size: 0.9em; + font-weight: bold; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + display: block; + line-height: 1.2em; + font-size: 0.85em; + color: #63676d; + padding-right: 2px; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--no-results { + width: 100%; + padding: 8px 0; + text-align: center; + font-size: 1.2em; + background-color: #373940; + margin-top: -8px; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion--no-results + .algolia-docsearch-suggestion--text { + color: #ffffff; + margin-top: 4px; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--no-results::before { + display: none; +} + +.algolia-autocomplete .algolia-docsearch-suggestion code { + padding: 1px 5px; + font-size: 90%; + border: none; + color: #222222; + background-color: #ebebeb; + border-radius: 3px; + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion + code + .algolia-docsearch-suggestion--highlight { + background: none; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main + .algolia-docsearch-suggestion--category-header { + color: white; + display: block; +} + +.algolia-autocomplete + .algolia-docsearch-suggestion.algolia-docsearch-suggestion__secondary + .algolia-docsearch-suggestion--subcategory-column { + display: block; +} + +.algolia-autocomplete .algolia-docsearch-footer { + background-color: #fff; + width: 100%; + height: 30px; + z-index: 2000; + float: right; + font-size: 0; + line-height: 0; +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 18'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='-36.87%25' x2='129.43%25' y1='134.94%25' y2='-27.7%25'%3E%3Cstop stop-color='%252300AEFF' offset='0%25'/%3E%3Cstop stop-color='%25233369E7' offset='100%25'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath fill='url(%2523a)' d='M59.4.02h13.3a2.37 2.37 0 0 1 2.38 2.37V15.6a2.37 2.37 0 0 1-2.38 2.36H59.4a2.37 2.37 0 0 1-2.38-2.36V2.38A2.37 2.37 0 0 1 59.4.02z'/%3E%3Cpath fill='%2523FFF' d='M66.26 4.56c-2.82 0-5.1 2.27-5.1 5.08 0 2.8 2.28 5.07 5.1 5.07 2.8 0 5.1-2.26 5.1-5.07 0-2.8-2.28-5.07-5.1-5.07zm0 8.65c-2 0-3.6-1.6-3.6-3.56 0-1.97 1.6-3.58 3.6-3.58 1.98 0 3.6 1.6 3.6 3.58a3.58 3.58 0 0 1-3.6 3.57zm0-6.4v2.66c0 .07.08.13.15.1l2.4-1.24c.04-.02.06-.1.03-.14a2.96 2.96 0 0 0-2.46-1.5c-.06 0-.1.05-.1.1zm-3.33-1.96l-.3-.3a.78.78 0 0 0-1.12 0l-.36.36a.77.77 0 0 0 0 1.1l.3.3c.05.05.13.04.17 0 .2-.25.4-.5.6-.7.23-.23.46-.43.7-.6.07-.04.07-.1.03-.16zm5-.8V3.4a.78.78 0 0 0-.78-.78h-1.83a.78.78 0 0 0-.78.78v.63c0 .07.06.12.14.1a5.74 5.74 0 0 1 1.58-.22c.52 0 1.04.07 1.54.2a.1.1 0 0 0 .13-.1z'/%3E%3Cpath fill='%2523182359' d='M102.16 13.76c0 1.46-.37 2.52-1.12 3.2-.75.67-1.9 1-3.44 1-.56 0-1.74-.1-2.67-.3l.34-1.7c.78.17 1.82.2 2.36.2.86 0 1.48-.16 1.84-.5.37-.36.55-.88.55-1.57v-.35a6.37 6.37 0 0 1-.84.3 4.15 4.15 0 0 1-1.2.17 4.5 4.5 0 0 1-1.6-.28 3.38 3.38 0 0 1-1.26-.82 3.74 3.74 0 0 1-.8-1.35c-.2-.54-.3-1.5-.3-2.2 0-.67.1-1.5.3-2.06a3.92 3.92 0 0 1 .9-1.43 4.12 4.12 0 0 1 1.45-.92 5.3 5.3 0 0 1 1.94-.37c.7 0 1.35.1 1.97.2a15.86 15.86 0 0 1 1.6.33v8.46zm-5.95-4.2c0 .9.2 1.88.6 2.3.4.4.9.62 1.53.62.34 0 .66-.05.96-.15a2.75 2.75 0 0 0 .73-.33V6.7a8.53 8.53 0 0 0-1.42-.17c-.76-.02-1.36.3-1.77.8-.4.5-.62 1.4-.62 2.23zm16.13 0c0 .72-.1 1.26-.32 1.85a4.4 4.4 0 0 1-.9 1.53c-.38.42-.85.75-1.4.98-.54.24-1.4.37-1.8.37-.43 0-1.27-.13-1.8-.36a4.1 4.1 0 0 1-1.4-.97 4.5 4.5 0 0 1-.92-1.52 5.04 5.04 0 0 1-.33-1.84c0-.72.1-1.4.32-2 .22-.6.53-1.1.92-1.5.4-.43.86-.75 1.4-.98a4.55 4.55 0 0 1 1.78-.34 4.7 4.7 0 0 1 1.8.34c.54.23 1 .55 1.4.97.38.42.68.92.9 1.5.23.6.35 1.3.35 2zm-2.2 0c0-.92-.2-1.7-.6-2.22-.38-.54-.94-.8-1.64-.8-.72 0-1.27.26-1.67.8-.4.54-.58 1.3-.58 2.22 0 .93.2 1.56.6 2.1.38.54.94.8 1.64.8s1.25-.26 1.65-.8c.4-.55.6-1.17.6-2.1zm6.97 4.7c-3.5.02-3.5-2.8-3.5-3.27L113.57.92l2.15-.34v10c0 .25 0 1.87 1.37 1.88v1.8zm3.77 0h-2.15v-9.2l2.15-.33v9.54zM119.8 3.74c.7 0 1.3-.58 1.3-1.3 0-.7-.58-1.3-1.3-1.3-.73 0-1.3.6-1.3 1.3 0 .72.58 1.3 1.3 1.3zm6.43 1c.7 0 1.3.1 1.78.27.5.18.88.42 1.17.73.28.3.5.74.6 1.18.13.46.2.95.2 1.5v5.47a25.24 25.24 0 0 1-1.5.25c-.67.1-1.42.15-2.25.15a6.83 6.83 0 0 1-1.52-.16 3.2 3.2 0 0 1-1.18-.5 2.46 2.46 0 0 1-.76-.9c-.18-.37-.27-.9-.27-1.44 0-.52.1-.85.3-1.2.2-.37.48-.67.83-.9a3.6 3.6 0 0 1 1.23-.5 7.07 7.07 0 0 1 2.2-.1l.83.16v-.35c0-.25-.03-.48-.1-.7a1.5 1.5 0 0 0-.3-.58c-.15-.18-.34-.3-.58-.4a2.54 2.54 0 0 0-.92-.17c-.5 0-.94.06-1.35.13-.4.08-.75.16-1 .25l-.27-1.74c.27-.1.67-.18 1.2-.28a9.34 9.34 0 0 1 1.65-.14zm.18 7.74c.66 0 1.15-.04 1.5-.1V10.2a5.1 5.1 0 0 0-2-.1c-.23.03-.45.1-.64.2a1.17 1.17 0 0 0-.47.38c-.13.17-.18.26-.18.52 0 .5.17.8.5.98.32.2.74.3 1.3.3zM84.1 4.8c.72 0 1.3.08 1.8.26.48.17.87.42 1.15.73.3.3.5.72.6 1.17.14.45.2.94.2 1.47v5.48a25.24 25.24 0 0 1-1.5.26c-.67.1-1.42.14-2.25.14a6.83 6.83 0 0 1-1.52-.16 3.2 3.2 0 0 1-1.18-.5 2.46 2.46 0 0 1-.76-.9c-.18-.38-.27-.9-.27-1.44 0-.53.1-.86.3-1.22.2-.36.5-.65.84-.88a3.6 3.6 0 0 1 1.24-.5 7.07 7.07 0 0 1 2.2-.1c.26.03.54.08.84.15v-.35c0-.24-.03-.48-.1-.7a1.5 1.5 0 0 0-.3-.58c-.15-.17-.34-.3-.58-.4a2.54 2.54 0 0 0-.9-.15c-.5 0-.96.05-1.37.12-.4.07-.75.15-1 .24l-.26-1.75c.27-.08.67-.17 1.18-.26a8.9 8.9 0 0 1 1.66-.15zm.2 7.73c.65 0 1.14-.04 1.48-.1v-2.17a5.1 5.1 0 0 0-1.98-.1c-.24.03-.46.1-.65.18a1.17 1.17 0 0 0-.47.4c-.12.17-.17.26-.17.52 0 .5.18.8.5.98.32.2.75.3 1.3.3zm8.68 1.74c-3.5 0-3.5-2.82-3.5-3.28L89.45.92 91.6.6v10c0 .25 0 1.87 1.38 1.88v1.8z'/%3E%3Cpath fill='%25231D3657' d='M5.03 11.03c0 .7-.26 1.24-.76 1.64-.5.4-1.2.6-2.1.6-.88 0-1.6-.14-2.17-.42v-1.2c.36.16.74.3 1.14.38.4.1.78.15 1.13.15.5 0 .88-.1 1.12-.3a.94.94 0 0 0 .35-.77.98.98 0 0 0-.33-.74c-.22-.2-.68-.44-1.37-.72-.72-.3-1.22-.62-1.52-1C.23 8.27.1 7.82.1 7.3c0-.65.22-1.17.7-1.55.46-.37 1.08-.56 1.86-.56.76 0 1.5.16 2.25.48l-.4 1.05c-.7-.3-1.32-.44-1.87-.44-.4 0-.73.08-.94.26a.9.9 0 0 0-.33.72c0 .2.04.38.12.52.08.15.22.3.42.4.2.14.55.3 1.06.52.58.24 1 .47 1.27.67.27.2.47.44.6.7.12.26.18.57.18.92zM9 13.27c-.92 0-1.64-.27-2.16-.8-.52-.55-.78-1.3-.78-2.24 0-.97.24-1.73.72-2.3.5-.54 1.15-.82 2-.82.78 0 1.4.25 1.85.72.46.48.7 1.14.7 1.97v.67H7.35c0 .58.17 1.02.46 1.33.3.3.7.47 1.24.47.36 0 .68-.04.98-.1a5.1 5.1 0 0 0 .98-.33v1.02a3.87 3.87 0 0 1-.94.32 5.72 5.72 0 0 1-1.08.1zm-.22-5.2c-.4 0-.73.12-.97.38s-.37.62-.42 1.1h2.7c0-.48-.13-.85-.36-1.1-.23-.26-.54-.38-.94-.38zm7.7 5.1l-.26-.84h-.05c-.28.36-.57.6-.86.74-.28.13-.65.2-1.1.2-.6 0-1.05-.16-1.38-.48-.32-.32-.5-.77-.5-1.34 0-.62.24-1.08.7-1.4.45-.3 1.14-.47 2.07-.5l1.02-.03V9.2c0-.37-.1-.65-.27-.84-.17-.2-.45-.28-.82-.28-.3 0-.6.04-.88.13a6.68 6.68 0 0 0-.8.33l-.4-.9a4.4 4.4 0 0 1 1.05-.4 4.86 4.86 0 0 1 1.08-.12c.76 0 1.33.18 1.7.5.4.33.6.85.6 1.56v4h-.9zm-1.9-.87c.47 0 .83-.13 1.1-.38.3-.26.43-.62.43-1.08v-.52l-.76.03c-.6.03-1.02.13-1.3.3s-.4.45-.4.82c0 .26.08.47.24.6.16.16.4.23.7.23zm7.57-5.2c.25 0 .46.03.62.06l-.12 1.18a2.38 2.38 0 0 0-.56-.06c-.5 0-.92.16-1.24.5-.3.32-.47.75-.47 1.27v3.1h-1.27V7.23h1l.16 1.05h.05c.2-.36.45-.64.77-.85a1.83 1.83 0 0 1 1.02-.3zm4.12 6.17c-.9 0-1.58-.27-2.05-.8-.47-.52-.7-1.27-.7-2.25 0-1 .24-1.77.73-2.3.5-.54 1.2-.8 2.12-.8.63 0 1.2.1 1.7.34l-.4 1c-.52-.2-.96-.3-1.3-.3-1.04 0-1.55.68-1.55 2.05 0 .67.13 1.17.38 1.5.26.34.64.5 1.13.5a3.23 3.23 0 0 0 1.6-.4v1.1a2.53 2.53 0 0 1-.73.28 4.36 4.36 0 0 1-.93.08zm8.28-.1h-1.27V9.5c0-.45-.1-.8-.28-1.02-.18-.23-.47-.34-.88-.34-.53 0-.9.16-1.16.48-.25.3-.38.85-.38 1.6v2.94h-1.26V4.8h1.26v2.12c0 .34-.02.7-.06 1.1h.08a1.76 1.76 0 0 1 .72-.67c.3-.16.66-.24 1.07-.24 1.43 0 2.15.74 2.15 2.2v3.86zM42.2 7.1c.74 0 1.32.28 1.73.82.4.53.62 1.3.62 2.26 0 .97-.2 1.73-.63 2.27-.42.54-1 .82-1.75.82s-1.33-.27-1.75-.8h-.08l-.23.7h-.94V4.8h1.26v2l-.02.64-.03.56h.05c.4-.6 1-.9 1.78-.9zm-.33 1.04c-.5 0-.88.15-1.1.45-.22.3-.34.8-.35 1.5v.08c0 .72.12 1.24.35 1.57.23.32.6.48 1.12.48.44 0 .78-.17 1-.53.24-.35.36-.87.36-1.53 0-1.35-.47-2.03-1.4-2.03zm3.24-.92h1.4l1.2 3.37c.18.47.3.92.36 1.34h.04l.18-.72 1.37-4H51l-2.53 6.73c-.46 1.23-1.23 1.85-2.3 1.85-.3 0-.56-.03-.83-.1v-1c.2.05.4.08.65.08.6 0 1.03-.36 1.28-1.06l.22-.56-2.4-5.94z'/%3E%3C/g%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: center; + background-size: 100%; + overflow: hidden; + text-indent: -9000px; + width: 110px; + height: 100%; + display: block; + margin-left: auto; + margin-right: 5px; +} diff --git a/packages/artplayer-document/src/theme/SearchBar/index.js b/packages/artplayer-document/src/theme/SearchBar/index.js new file mode 100644 index 000000000..53f73d3ff --- /dev/null +++ b/packages/artplayer-document/src/theme/SearchBar/index.js @@ -0,0 +1,110 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, { useRef, useCallback } from "react"; +import classnames from "classnames"; +import { useHistory } from "@docusaurus/router"; +import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; +import { usePluginData } from '@docusaurus/useGlobalData'; +const Search = props => { + const initialized = useRef(false); + const searchBarRef = useRef(null); + const history = useHistory(); + const { siteConfig = {} } = useDocusaurusContext(); + const { baseUrl } = siteConfig; + const initAlgolia = (searchDocs, searchIndex, DocSearch) => { + new DocSearch({ + searchDocs, + searchIndex, + inputSelector: "#search_input_react", + // Override algolia's default selection event, allowing us to do client-side + // navigation and avoiding a full page refresh. + handleSelected: (_input, _event, suggestion) => { + const url = baseUrl + suggestion.url; + // Use an anchor tag to parse the absolute url into a relative url + // Alternatively, we can use new URL(suggestion.url) but its not supported in IE + const a = document.createElement("a"); + a.href = url; + // Algolia use closest parent element id #__docusaurus when a h1 page title does not have an id + // So, we can safely remove it. See https://github.com/facebook/docusaurus/issues/1828 for more details. + + history.push(url); + } + }); + }; + + const pluginData = usePluginData('docusaurus-lunr-search'); + const getSearchDoc = () => + process.env.NODE_ENV === "production" + ? fetch(`${baseUrl}${pluginData.fileNames.searchDoc}`).then((content) => content.json()) + : Promise.resolve([]); + + const getLunrIndex = () => + process.env.NODE_ENV === "production" + ? fetch(`${baseUrl}${pluginData.fileNames.lunrIndex}`).then((content) => content.json()) + : Promise.resolve([]); + + const loadAlgolia = () => { + if (!initialized.current) { + Promise.all([ + getSearchDoc(), + getLunrIndex(), + import("./lib/DocSearch"), + import("./algolia.css") + ]).then(([searchDocs, searchIndex, { default: DocSearch }]) => { + if( searchDocs.length === 0) { + return; + } + initAlgolia(searchDocs, searchIndex, DocSearch); + }); + initialized.current = true; + } + }; + + const toggleSearchIconClick = useCallback( + e => { + if (!searchBarRef.current.contains(e.target)) { + searchBarRef.current.focus(); + } + props.handleSearchBarToggle && props.handleSearchBarToggle(!props.isSearchBarExpanded); + }, + [props.isSearchBarExpanded] + ); + + return ( +
+ + +
+ ); +}; + +export default Search; diff --git a/packages/artplayer-document/src/theme/SearchBar/lib/DocSearch.js b/packages/artplayer-document/src/theme/SearchBar/lib/DocSearch.js new file mode 100644 index 000000000..ffdca6a59 --- /dev/null +++ b/packages/artplayer-document/src/theme/SearchBar/lib/DocSearch.js @@ -0,0 +1,306 @@ +import Hogan from "hogan.js"; +import LunrSearchAdapter from "./lunar-search"; +import autocomplete from "autocomplete.js"; +import templates from "./templates"; +import utils from "./utils"; +import $ from "autocomplete.js/zepto"; + +/** + * Adds an autocomplete dropdown to an input field + * @function DocSearch + * @param {Object} options.searchDocs Search Documents + * @param {Object} options.searchIndex Lune searchIndexes + * @param {string} options.inputSelector CSS selector that targets the input + * value. + * @param {Object} [options.autocompleteOptions] Options to pass to the underlying autocomplete instance + * @return {Object} + */ +class DocSearch { + constructor({ + searchDocs, + searchIndex, + inputSelector, + debug = false, + queryDataCallback = null, + autocompleteOptions = { + debug: false, + hint: false, + autoselect: true + }, + transformData = false, + queryHook = false, + handleSelected = false, + enhancedSearchInput = false, + layout = "collumns" + }) { + this.input = DocSearch.getInputFromSelector(inputSelector); + this.queryDataCallback = queryDataCallback || null; + const autocompleteOptionsDebug = + autocompleteOptions && autocompleteOptions.debug + ? autocompleteOptions.debug + : false; + // eslint-disable-next-line no-param-reassign + autocompleteOptions.debug = debug || autocompleteOptionsDebug; + this.autocompleteOptions = autocompleteOptions; + this.autocompleteOptions.cssClasses = + this.autocompleteOptions.cssClasses || {}; + this.autocompleteOptions.cssClasses.prefix = + this.autocompleteOptions.cssClasses.prefix || "ds"; + const inputAriaLabel = + this.input && + typeof this.input.attr === "function" && + this.input.attr("aria-label"); + this.autocompleteOptions.ariaLabel = + this.autocompleteOptions.ariaLabel || inputAriaLabel || "search input"; + + this.isSimpleLayout = layout === "simple"; + + this.client = new LunrSearchAdapter(searchDocs, searchIndex); + + if (enhancedSearchInput) { + this.input = DocSearch.injectSearchBox(this.input); + } + this.autocomplete = autocomplete(this.input, autocompleteOptions, [ + { + source: this.getAutocompleteSource(transformData, queryHook), + templates: { + suggestion: DocSearch.getSuggestionTemplate(this.isSimpleLayout), + footer: templates.footer, + empty: DocSearch.getEmptyTemplate() + } + } + ]); + + const customHandleSelected = handleSelected; + this.handleSelected = customHandleSelected || this.handleSelected; + + // We prevent default link clicking if a custom handleSelected is defined + if (customHandleSelected) { + $(".algolia-autocomplete").on("click", ".ds-suggestions a", event => { + event.preventDefault(); + }); + } + + this.autocomplete.on( + "autocomplete:selected", + this.handleSelected.bind(null, this.autocomplete.autocomplete) + ); + + this.autocomplete.on( + "autocomplete:shown", + this.handleShown.bind(null, this.input) + ); + + if (enhancedSearchInput) { + DocSearch.bindSearchBoxEvent(); + } + } + + static injectSearchBox(input) { + input.before(templates.searchBox); + const newInput = input + .prev() + .prev() + .find("input"); + input.remove(); + return newInput; + } + + static bindSearchBoxEvent() { + $('.searchbox [type="reset"]').on("click", function () { + $("input#docsearch").focus(); + $(this).addClass("hide"); + autocomplete.autocomplete.setVal(""); + }); + + $("input#docsearch").on("keyup", () => { + const searchbox = document.querySelector("input#docsearch"); + const reset = document.querySelector('.searchbox [type="reset"]'); + reset.className = "searchbox__reset"; + if (searchbox.value.length === 0) { + reset.className += " hide"; + } + }); + } + + /** + * Returns the matching input from a CSS selector, null if none matches + * @function getInputFromSelector + * @param {string} selector CSS selector that matches the search + * input of the page + * @returns {void} + */ + static getInputFromSelector(selector) { + const input = $(selector).filter("input"); + return input.length ? $(input[0]) : null; + } + + /** + * Returns the `source` method to be passed to autocomplete.js. It will query + * the Algolia index and call the callbacks with the formatted hits. + * @function getAutocompleteSource + * @param {function} transformData An optional function to transform the hits + * @param {function} queryHook An optional function to transform the query + * @returns {function} Method to be passed as the `source` option of + * autocomplete + */ + getAutocompleteSource(transformData, queryHook) { + return (query, callback) => { + if (queryHook) { + // eslint-disable-next-line no-param-reassign + query = queryHook(query) || query; + } + this.client.search(query).then(hits => { + if ( + this.queryDataCallback && + typeof this.queryDataCallback == "function" + ) { + this.queryDataCallback(hits); + } + if (transformData) { + hits = transformData(hits) || hits; + } + callback(DocSearch.formatHits(hits)); + }); + }; + } + + // Given a list of hits returned by the API, will reformat them to be used in + // a Hogan template + static formatHits(receivedHits) { + const clonedHits = utils.deepClone(receivedHits); + const hits = clonedHits.map(hit => { + if (hit._highlightResult) { + // eslint-disable-next-line no-param-reassign + hit._highlightResult = utils.mergeKeyWithParent( + hit._highlightResult, + "hierarchy" + ); + } + return utils.mergeKeyWithParent(hit, "hierarchy"); + }); + + // Group hits by category / subcategory + let groupedHits = utils.groupBy(hits, "lvl0"); + $.each(groupedHits, (level, collection) => { + const groupedHitsByLvl1 = utils.groupBy(collection, "lvl1"); + const flattenedHits = utils.flattenAndFlagFirst( + groupedHitsByLvl1, + "isSubCategoryHeader" + ); + groupedHits[level] = flattenedHits; + }); + groupedHits = utils.flattenAndFlagFirst(groupedHits, "isCategoryHeader"); + + // Translate hits into smaller objects to be send to the template + return groupedHits.map(hit => { + const url = DocSearch.formatURL(hit); + const category = utils.getHighlightedValue(hit, "lvl0"); + const subcategory = utils.getHighlightedValue(hit, "lvl1") || category; + const displayTitle = utils + .compact([ + utils.getHighlightedValue(hit, "lvl2") || subcategory, + utils.getHighlightedValue(hit, "lvl3"), + utils.getHighlightedValue(hit, "lvl4"), + utils.getHighlightedValue(hit, "lvl5"), + utils.getHighlightedValue(hit, "lvl6") + ]) + .join( + '' + ); + const text = utils.getSnippetedValue(hit, "content"); + const isTextOrSubcategoryNonEmpty = + (subcategory && subcategory !== "") || + (displayTitle && displayTitle !== ""); + const isLvl1EmptyOrDuplicate = + !subcategory || subcategory === "" || subcategory === category; + const isLvl2 = + displayTitle && displayTitle !== "" && displayTitle !== subcategory; + const isLvl1 = + !isLvl2 && + (subcategory && subcategory !== "" && subcategory !== category); + const isLvl0 = !isLvl1 && !isLvl2; + + return { + isLvl0, + isLvl1, + isLvl2, + isLvl1EmptyOrDuplicate, + isCategoryHeader: hit.isCategoryHeader, + isSubCategoryHeader: hit.isSubCategoryHeader, + isTextOrSubcategoryNonEmpty, + category, + subcategory, + title: displayTitle, + text, + url + }; + }); + } + + static formatURL(hit) { + const { url, anchor } = hit; + if (url) { + const containsAnchor = url.indexOf("#") !== -1; + if (containsAnchor) return url; + else if (anchor) return `${hit.url}#${hit.anchor}`; + return url; + } else if (anchor) return `#${hit.anchor}`; + /* eslint-disable */ + console.warn("no anchor nor url for : ", JSON.stringify(hit)); + /* eslint-enable */ + return null; + } + + static getEmptyTemplate() { + return args => Hogan.compile(templates.empty).render(args); + } + + static getSuggestionTemplate(isSimpleLayout) { + const stringTemplate = isSimpleLayout + ? templates.suggestionSimple + : templates.suggestion; + const template = Hogan.compile(stringTemplate); + return suggestion => template.render(suggestion); + } + + handleSelected(input, event, suggestion, datasetNumber, context = {}) { + // Do nothing if click on the suggestion, as it's already a , the + // browser will take care of it. This allow Ctrl-Clicking on results and not + // having the main window being redirected as well + if (context.selectionMethod === "click") { + return; + } + + input.setVal(""); + window.location.assign(suggestion.url); + } + + handleShown(input) { + const middleOfInput = input.offset().left + input.width() / 2; + let middleOfWindow = $(document).width() / 2; + + if (isNaN(middleOfWindow)) { + middleOfWindow = 900; + } + + const alignClass = + middleOfInput - middleOfWindow >= 0 + ? "algolia-autocomplete-right" + : "algolia-autocomplete-left"; + const otherAlignClass = + middleOfInput - middleOfWindow < 0 + ? "algolia-autocomplete-right" + : "algolia-autocomplete-left"; + const autocompleteWrapper = $(".algolia-autocomplete"); + if (!autocompleteWrapper.hasClass(alignClass)) { + autocompleteWrapper.addClass(alignClass); + } + + if (autocompleteWrapper.hasClass(otherAlignClass)) { + autocompleteWrapper.removeClass(otherAlignClass); + } + } +} + +export default DocSearch; \ No newline at end of file diff --git a/packages/artplayer-document/src/theme/SearchBar/lib/lunar-search.js b/packages/artplayer-document/src/theme/SearchBar/lib/lunar-search.js new file mode 100644 index 000000000..159b79504 --- /dev/null +++ b/packages/artplayer-document/src/theme/SearchBar/lib/lunar-search.js @@ -0,0 +1,146 @@ +import lunr from "@generated/lunr.client"; +lunr.tokenizer.separator = /[\s\-/]+/; + +class LunrSearchAdapter { + constructor(searchDocs, searchIndex) { + this.searchDocs = searchDocs; + this.lunrIndex = lunr.Index.load(searchIndex); + } + + getLunrResult(input) { + return this.lunrIndex.query(function (query) { + const tokens = lunr.tokenizer(input); + query.term(tokens, { + boost: 10 + }); + query.term(tokens, { + wildcard: lunr.Query.wildcard.TRAILING + }); + }); + } + + getHit(doc, formattedTitle, formattedContent) { + return { + hierarchy: { + lvl0: doc.pageTitle || doc.title, + lvl1: doc.type === 0 ? null : doc.title + }, + url: doc.url, + _snippetResult: formattedContent ? { + content: { + value: formattedContent, + matchLevel: "full" + } + } : null, + _highlightResult: { + hierarchy: { + lvl0: { + value: doc.type === 0 ? formattedTitle || doc.title : doc.pageTitle, + }, + lvl1: + doc.type === 0 + ? null + : { + value: formattedTitle || doc.title + } + } + } + }; + } + getTitleHit(doc, position, length) { + const start = position[0]; + const end = position[0] + length; + let formattedTitle = doc.title.substring(0, start) + '' + doc.title.substring(start, end) + '' + doc.title.substring(end, doc.title.length); + return this.getHit(doc, formattedTitle) + } + + getKeywordHit(doc, position, length) { + const start = position[0]; + const end = position[0] + length; + let formattedTitle = doc.title + '
Keywords: ' + doc.keywords.substring(0, start) + '' + doc.keywords.substring(start, end) + '' + doc.keywords.substring(end, doc.keywords.length) + '' + return this.getHit(doc, formattedTitle) + } + + getContentHit(doc, position) { + const start = position[0]; + const end = position[0] + position[1]; + let previewStart = start; + let previewEnd = end; + let ellipsesBefore = true; + let ellipsesAfter = true; + for (let k = 0; k < 3; k++) { + const nextSpace = doc.content.lastIndexOf(' ', previewStart - 2); + const nextDot = doc.content.lastIndexOf('.', previewStart - 2); + if ((nextDot > 0) && (nextDot > nextSpace)) { + previewStart = nextDot + 1; + ellipsesBefore = false; + break; + } + if (nextSpace < 0) { + previewStart = 0; + ellipsesBefore = false; + break; + } + previewStart = nextSpace + 1; + } + for (let k = 0; k < 10; k++) { + const nextSpace = doc.content.indexOf(' ', previewEnd + 1); + const nextDot = doc.content.indexOf('.', previewEnd + 1); + if ((nextDot > 0) && (nextDot < nextSpace)) { + previewEnd = nextDot; + ellipsesAfter = false; + break; + } + if (nextSpace < 0) { + previewEnd = doc.content.length; + ellipsesAfter = false; + break; + } + previewEnd = nextSpace; + } + let preview = doc.content.substring(previewStart, start); + if (ellipsesBefore) { + preview = '... ' + preview; + } + preview += '' + doc.content.substring(start, end) + ''; + preview += doc.content.substring(end, previewEnd); + if (ellipsesAfter) { + preview += ' ...'; + } + return this.getHit(doc, null, preview); + + } + search(input) { + return new Promise((resolve, rej) => { + const results = this.getLunrResult(input); + const hits = []; + results.length > 5 && (results.length = 5); + this.titleHitsRes = [] + this.contentHitsRes = [] + results.forEach(result => { + const doc = this.searchDocs[result.ref]; + const { metadata } = result.matchData; + for (let i in metadata) { + if (metadata[i].title) { + if (!this.titleHitsRes.includes(result.ref)) { + const position = metadata[i].title.position[0] + hits.push(this.getTitleHit(doc, position, input.length)); + this.titleHitsRes.push(result.ref); + } + } else if (metadata[i].content) { + const position = metadata[i].content.position[0] + hits.push(this.getContentHit(doc, position)) + } else if (metadata[i].keywords) { + const position = metadata[i].keywords.position[0] + hits.push(this.getKeywordHit(doc, position, input.length)); + this.titleHitsRes.push(result.ref); + } + } + }); + hits.length > 5 && (hits.length = 5); + resolve(hits); + }); + } +} + +export default LunrSearchAdapter; diff --git a/packages/artplayer-document/src/theme/SearchBar/lib/templates.js b/packages/artplayer-document/src/theme/SearchBar/lib/templates.js new file mode 100644 index 000000000..c7ea998fd --- /dev/null +++ b/packages/artplayer-document/src/theme/SearchBar/lib/templates.js @@ -0,0 +1,114 @@ +const prefix = 'algolia-docsearch'; +const suggestionPrefix = `${prefix}-suggestion`; +const footerPrefix = `${prefix}-footer`; + +/* eslint-disable max-len */ + +const templates = { + suggestion: ` +
+
+ {{{category}}} +
+
+
+ {{{subcategory}}} +
+ {{#isTextOrSubcategoryNonEmpty}} +
+
{{{subcategory}}}
+
{{{title}}}
+ {{#text}}
{{{text}}}
{{/text}} +
+ {{/isTextOrSubcategoryNonEmpty}} +
+
+ `, + suggestionSimple: ` +
+
+ {{^isLvl0}} + {{{category}}} + {{^isLvl1}} + {{^isLvl1EmptyOrDuplicate}} + + {{{subcategory}}} + + {{/isLvl1EmptyOrDuplicate}} + {{/isLvl1}} + {{/isLvl0}} +
+ {{#isLvl2}} + {{{title}}} + {{/isLvl2}} + {{#isLvl1}} + {{{subcategory}}} + {{/isLvl1}} + {{#isLvl0}} + {{{category}}} + {{/isLvl0}} +
+
+
+ {{#text}} +
+
{{{text}}}
+
+ {{/text}} +
+
+ `, + footer: ` +
+
+ `, + empty: ` +
+
+
+
+
+ No results found for query "{{query}}" +
+
+
+
+
+ `, + searchBox: ` + + + + `, +}; + +export default templates; diff --git a/packages/artplayer-document/src/theme/SearchBar/lib/utils.js b/packages/artplayer-document/src/theme/SearchBar/lib/utils.js new file mode 100644 index 000000000..0807500d7 --- /dev/null +++ b/packages/artplayer-document/src/theme/SearchBar/lib/utils.js @@ -0,0 +1,270 @@ +import $ from "autocomplete.js/zepto"; + +const utils = { + /* + * Move the content of an object key one level higher. + * eg. + * { + * name: 'My name', + * hierarchy: { + * lvl0: 'Foo', + * lvl1: 'Bar' + * } + * } + * Will be converted to + * { + * name: 'My name', + * lvl0: 'Foo', + * lvl1: 'Bar' + * } + * @param {Object} object Main object + * @param {String} property Main object key to move up + * @return {Object} + * @throws Error when key is not an attribute of Object or is not an object itself + */ + mergeKeyWithParent(object, property) { + if (object[property] === undefined) { + return object; + } + if (typeof object[property] !== 'object') { + return object; + } + const newObject = $.extend({}, object, object[property]); + delete newObject[property]; + return newObject; + }, + /* + * Group all objects of a collection by the value of the specified attribute + * If the attribute is a string, use the lowercase form. + * + * eg. + * groupBy([ + * {name: 'Tim', category: 'dev'}, + * {name: 'Vincent', category: 'dev'}, + * {name: 'Ben', category: 'sales'}, + * {name: 'Jeremy', category: 'sales'}, + * {name: 'AlexS', category: 'dev'}, + * {name: 'AlexK', category: 'sales'} + * ], 'category'); + * => + * { + * 'devs': [ + * {name: 'Tim', category: 'dev'}, + * {name: 'Vincent', category: 'dev'}, + * {name: 'AlexS', category: 'dev'} + * ], + * 'sales': [ + * {name: 'Ben', category: 'sales'}, + * {name: 'Jeremy', category: 'sales'}, + * {name: 'AlexK', category: 'sales'} + * ] + * } + * @param {array} collection Array of objects to group + * @param {String} property The attribute on which apply the grouping + * @return {array} + * @throws Error when one of the element does not have the specified property + */ + groupBy(collection, property) { + const newCollection = {}; + $.each(collection, (index, item) => { + if (item[property] === undefined) { + throw new Error(`[groupBy]: Object has no key ${property}`); + } + let key = item[property]; + if (typeof key === 'string') { + key = key.toLowerCase(); + } + // fix #171 the given data type of docsearch hits might be conflict with the properties of the native Object, + // such as the constructor, so we need to do this check. + if (!Object.prototype.hasOwnProperty.call(newCollection, key)) { + newCollection[key] = []; + } + newCollection[key].push(item); + }); + return newCollection; + }, + /* + * Return an array of all the values of the specified object + * eg. + * values({ + * foo: 42, + * bar: true, + * baz: 'yep' + * }) + * => + * [42, true, yep] + * @param {object} object Object to extract values from + * @return {array} + */ + values(object) { + return Object.keys(object).map(key => object[key]); + }, + /* + * Flattens an array + * eg. + * flatten([1, 2, [3, 4], [5, 6]]) + * => + * [1, 2, 3, 4, 5, 6] + * @param {array} array Array to flatten + * @return {array} + */ + flatten(array) { + const results = []; + array.forEach(value => { + if (!Array.isArray(value)) { + results.push(value); + return; + } + value.forEach(subvalue => { + results.push(subvalue); + }); + }); + return results; + }, + /* + * Flatten all values of an object into an array, marking each first element of + * each group with a specific flag + * eg. + * flattenAndFlagFirst({ + * 'devs': [ + * {name: 'Tim', category: 'dev'}, + * {name: 'Vincent', category: 'dev'}, + * {name: 'AlexS', category: 'dev'} + * ], + * 'sales': [ + * {name: 'Ben', category: 'sales'}, + * {name: 'Jeremy', category: 'sales'}, + * {name: 'AlexK', category: 'sales'} + * ] + * , 'isTop'); + * => + * [ + * {name: 'Tim', category: 'dev', isTop: true}, + * {name: 'Vincent', category: 'dev', isTop: false}, + * {name: 'AlexS', category: 'dev', isTop: false}, + * {name: 'Ben', category: 'sales', isTop: true}, + * {name: 'Jeremy', category: 'sales', isTop: false}, + * {name: 'AlexK', category: 'sales', isTop: false} + * ] + * @param {object} object Object to flatten + * @param {string} flag Flag to set to true on first element of each group + * @return {array} + */ + flattenAndFlagFirst(object, flag) { + const values = this.values(object).map(collection => + collection.map((item, index) => { + // eslint-disable-next-line no-param-reassign + item[flag] = index === 0; + return item; + }) + ); + return this.flatten(values); + }, + /* + * Removes all empty strings, null, false and undefined elements array + * eg. + * compact([42, false, null, undefined, '', [], 'foo']); + * => + * [42, [], 'foo'] + * @param {array} array Array to compact + * @return {array} + */ + compact(array) { + const results = []; + array.forEach(value => { + if (!value) { + return; + } + results.push(value); + }); + return results; + }, + /* + * Returns the highlighted value of the specified key in the specified object. + * If no highlighted value is available, will return the key value directly + * eg. + * getHighlightedValue({ + * _highlightResult: { + * text: { + * value: 'foo' + * } + * }, + * text: 'foo' + * }, 'text'); + * => + * 'foo' + * @param {object} object Hit object returned by the Algolia API + * @param {string} property Object key to look for + * @return {string} + **/ + getHighlightedValue(object, property) { + if ( + object._highlightResult && + object._highlightResult.hierarchy_camel && + object._highlightResult.hierarchy_camel[property] && + object._highlightResult.hierarchy_camel[property].matchLevel && + object._highlightResult.hierarchy_camel[property].matchLevel !== 'none' && + object._highlightResult.hierarchy_camel[property].value + ) { + return object._highlightResult.hierarchy_camel[property].value; + } + if ( + object._highlightResult && + object._highlightResult && + object._highlightResult[property] && + object._highlightResult[property].value + ) { + return object._highlightResult[property].value; + } + return object[property]; + }, + /* + * Returns the snippeted value of the specified key in the specified object. + * If no highlighted value is available, will return the key value directly. + * Will add starting and ending ellipsis (…) if we detect that a sentence is + * incomplete + * eg. + * getSnippetedValue({ + * _snippetResult: { + * text: { + * value: 'This is an unfinished sentence' + * } + * }, + * text: 'This is an unfinished sentence' + * }, 'text'); + * => + * 'This is an unfinished sentence…' + * @param {object} object Hit object returned by the Algolia API + * @param {string} property Object key to look for + * @return {string} + **/ + getSnippetedValue(object, property) { + if ( + !object._snippetResult || + !object._snippetResult[property] || + !object._snippetResult[property].value + ) { + return object[property]; + } + let snippet = object._snippetResult[property].value; + + if (snippet[0] !== snippet[0].toUpperCase()) { + snippet = `…${snippet}`; + } + if (['.', '!', '?'].indexOf(snippet[snippet.length - 1]) === -1) { + snippet = `${snippet}…`; + } + return snippet; + }, + /* + * Deep clone an object. + * Note: This will not clone functions and dates + * @param {object} object Object to clone + * @return {object} + */ + deepClone(object) { + return JSON.parse(JSON.stringify(object)); + }, +}; + +export default utils; diff --git a/packages/artplayer-document/src/theme/SearchBar/styles.css b/packages/artplayer-document/src/theme/SearchBar/styles.css new file mode 100644 index 000000000..047517ec0 --- /dev/null +++ b/packages/artplayer-document/src/theme/SearchBar/styles.css @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +.search-icon { + background-image: var(--ifm-navbar-search-input-icon); + height: auto; + width: 24px; + cursor: pointer; + padding: 8px; + line-height: 32px; + background-repeat: no-repeat; + background-position: center; + display: none; +} + +.search-icon-hidden { + visibility: hidden; +} + +@media (max-width: 360px) { + .search-bar { + width: 0 !important; + background: none !important; + padding: 0 !important; + transition: none !important; + } + + .search-bar-expanded { + width: 9rem !important; + } + + .search-icon { + display: inline; + vertical-align: sub; + } +} diff --git a/packages/artplayer-document/static/img/ApplyForLloan.png b/packages/artplayer-document/static/img/ApplyForLloan.png new file mode 100644 index 000000000..59ffc5f84 Binary files /dev/null and b/packages/artplayer-document/static/img/ApplyForLloan.png differ diff --git a/packages/artplayer-document/static/img/Authorization.png b/packages/artplayer-document/static/img/Authorization.png new file mode 100644 index 000000000..702b95173 Binary files /dev/null and b/packages/artplayer-document/static/img/Authorization.png differ diff --git a/packages/artplayer-document/static/img/ContractContract.png b/packages/artplayer-document/static/img/ContractContract.png new file mode 100644 index 000000000..e71144da3 Binary files /dev/null and b/packages/artplayer-document/static/img/ContractContract.png differ diff --git a/packages/artplayer-document/static/img/RepaymentInformation.png b/packages/artplayer-document/static/img/RepaymentInformation.png new file mode 100644 index 000000000..615840ea6 Binary files /dev/null and b/packages/artplayer-document/static/img/RepaymentInformation.png differ diff --git a/packages/artplayer-document/static/img/SubmitBankCard.png b/packages/artplayer-document/static/img/SubmitBankCard.png new file mode 100644 index 000000000..458714c62 Binary files /dev/null and b/packages/artplayer-document/static/img/SubmitBankCard.png differ diff --git a/packages/artplayer-document/static/img/docusaurus.png b/packages/artplayer-document/static/img/docusaurus.png deleted file mode 100644 index f458149e3..000000000 Binary files a/packages/artplayer-document/static/img/docusaurus.png and /dev/null differ diff --git a/packages/artplayer-document/static/img/favicon.ico b/packages/artplayer-document/static/img/favicon.ico index c01d54bcd..fe35e8909 100644 Binary files a/packages/artplayer-document/static/img/favicon.ico and b/packages/artplayer-document/static/img/favicon.ico differ diff --git a/packages/artplayer-document/static/img/logo.png b/packages/artplayer-document/static/img/logo.png new file mode 100644 index 000000000..53431a844 Binary files /dev/null and b/packages/artplayer-document/static/img/logo.png differ diff --git a/packages/artplayer-document/static/img/logo.svg b/packages/artplayer-document/static/img/logo.svg deleted file mode 100644 index 9db6d0d06..000000000 --- a/packages/artplayer-document/static/img/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/artplayer-document/static/img/tutorial/docsVersionDropdown.png b/packages/artplayer-document/static/img/tutorial/docsVersionDropdown.png deleted file mode 100644 index ff1cbe688..000000000 Binary files a/packages/artplayer-document/static/img/tutorial/docsVersionDropdown.png and /dev/null differ diff --git a/packages/artplayer-document/static/img/tutorial/localeDropdown.png b/packages/artplayer-document/static/img/tutorial/localeDropdown.png deleted file mode 100644 index d7163f967..000000000 Binary files a/packages/artplayer-document/static/img/tutorial/localeDropdown.png and /dev/null differ diff --git a/packages/artplayer-document/static/img/undraw_docusaurus_mountain.svg b/packages/artplayer-document/static/img/undraw_docusaurus_mountain.svg deleted file mode 100644 index 431cef2f7..000000000 --- a/packages/artplayer-document/static/img/undraw_docusaurus_mountain.svg +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/artplayer-document/static/img/undraw_docusaurus_react.svg b/packages/artplayer-document/static/img/undraw_docusaurus_react.svg deleted file mode 100644 index e41705043..000000000 --- a/packages/artplayer-document/static/img/undraw_docusaurus_react.svg +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/artplayer-document/static/img/undraw_docusaurus_tree.svg b/packages/artplayer-document/static/img/undraw_docusaurus_tree.svg deleted file mode 100644 index a05cc03dd..000000000 --- a/packages/artplayer-document/static/img/undraw_docusaurus_tree.svg +++ /dev/null @@ -1 +0,0 @@ -docu_tree \ No newline at end of file