@graphcommerce/google-playstore 9.0.0-canary.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Config.graphqls +21 -0
- package/README.md +19 -0
- package/copy/pages/.well-known/assetlinks.json.tsx +2 -0
- package/index.ts +1 -0
- package/lib/getAssetLinksServerSideProps.tsx +29 -0
- package/next-env.d.ts +4 -0
- package/package.json +24 -0
- package/tsconfig.json +5 -0
package/Config.graphqls
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
See https://developer.android.com/training/app-links/verify-android-applinks#web-assoc
|
|
3
|
+
"""
|
|
4
|
+
input GraphCommerceGooglePlaystoreConfig {
|
|
5
|
+
"""
|
|
6
|
+
The package name of the Android app.
|
|
7
|
+
"""
|
|
8
|
+
packageName: String!
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
The sha256 certificate fingerprint of the Android app.
|
|
12
|
+
"""
|
|
13
|
+
sha256CertificateFingerprint: String!
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
extend input GraphCommerceConfig {
|
|
17
|
+
"""
|
|
18
|
+
To create an assetlinks.json file for the Android app.
|
|
19
|
+
"""
|
|
20
|
+
googlePlaystore: GraphCommerceGooglePlaystoreConfig
|
|
21
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @graphcommerce/google-playstore
|
|
2
|
+
|
|
3
|
+
Helper package to publish your app to the Google Playstore and be able to handle
|
|
4
|
+
the deep links from Android.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
1. Find current version of your `@graphcommerce/next-ui` in your package.json.
|
|
9
|
+
2. `yarn add @graphcommerce/google-playstore@1.2.3` (replace 1.2.3 with the
|
|
10
|
+
version of the step above)
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
Configure the following ([configuration values](./Config.graphqls)) in your
|
|
15
|
+
graphcommerce.config.js
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
GC_GOOGLE_PLAYSTORE='{"packageName":"com.example.app","sha256CertificateFingerprint":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}'
|
|
19
|
+
```
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getAssetLinksServerSideProps } from './lib/getAssetLinksServerSideProps'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GetServerSideProps } from 'next'
|
|
2
|
+
import type {} from '@graphcommerce/next-ui'
|
|
3
|
+
|
|
4
|
+
export const getAssetLinksServerSideProps: GetServerSideProps = async (context) => {
|
|
5
|
+
context.res.setHeader('Content-Type', 'application/json')
|
|
6
|
+
|
|
7
|
+
const package_name = import.meta.graphCommerce.googlePlaystore?.packageName
|
|
8
|
+
const sha256_cert_fingerprints = import.meta.graphCommerce.googlePlaystore
|
|
9
|
+
?.sha256CertificateFingerprint
|
|
10
|
+
|
|
11
|
+
if (!package_name || !sha256_cert_fingerprints) {
|
|
12
|
+
context.res.statusCode = 404
|
|
13
|
+
context.res.end()
|
|
14
|
+
return { props: {} }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
context.res.setHeader('Cache-Control', 'max-age=604800, public')
|
|
18
|
+
// https://developer.android.com/training/app-links/verify-android-applinks#web-assoc
|
|
19
|
+
context.res.write(
|
|
20
|
+
JSON.stringify([
|
|
21
|
+
{
|
|
22
|
+
relation: ['delegate_permission/common.handle_all_urls'],
|
|
23
|
+
target: { namespace: 'android_app', package_name, sha256_cert_fingerprints },
|
|
24
|
+
},
|
|
25
|
+
]),
|
|
26
|
+
)
|
|
27
|
+
context.res.end()
|
|
28
|
+
return { props: {} }
|
|
29
|
+
}
|
package/next-env.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@graphcommerce/google-playstore",
|
|
3
|
+
"version": "9.0.0-canary.106",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
6
|
+
"browserslist": [
|
|
7
|
+
"extends @graphcommerce/browserslist-config-pwa"
|
|
8
|
+
],
|
|
9
|
+
"eslintConfig": {
|
|
10
|
+
"extends": "@graphcommerce/eslint-config-pwa",
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"project": "./tsconfig.json"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.106",
|
|
17
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.106",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.106",
|
|
19
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.106",
|
|
20
|
+
"next": "*",
|
|
21
|
+
"react": "^18.2.0",
|
|
22
|
+
"react-dom": "^18.2.0"
|
|
23
|
+
}
|
|
24
|
+
}
|