Skip to content

Commit 33c334c

Browse files
author
Bannon Tanner
authored
fix(JS/RN): standardized 'configuring your app' steps (#5270)
* standardized 'configuring you app' steps * removed CLI prompt from indent rule
1 parent 2f91751 commit 33c334c

File tree

10 files changed

+251
-220
lines changed

10 files changed

+251
-220
lines changed

src/fragments/lib/analytics/js/getting-started/30_initAnalytics.mdx renamed to src/fragments/lib/analytics/native_common/getting-started/30_initAnalytics.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
It's recommended you add the Amplify configuration step to your app's root entry point. For example `App.js` in React or `main.ts` in Angular.
1+
import js0 from '/src/fragments/lib/common/js/import_configuration.mdx'
2+
3+
<Fragments fragments={{ js: js0 }} />
4+
5+
import rn1 from '/src/fragments/lib/common/react-native/import_configuration.mdx'
6+
7+
<Fragments fragments={{ 'react-native': rn1 }} />
28

39
```javascript
410
import { Amplify, Analytics } from 'aws-amplify';

src/fragments/lib/analytics/native_common/getting-started/common.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ import flutter11 from '/src/fragments/lib/analytics/flutter/getting-started/30_i
107107

108108
<Fragments fragments={{ flutter: flutter11 }} />
109109

110-
import js4 from '/src/fragments/lib/analytics/js/getting-started/30_initAnalytics.mdx';
110+
import js4 from '/src/fragments/lib/analytics/native_common/getting-started/30_initAnalytics.mdx';
111111

112112
<Fragments fragments={{ js: js4 }} />
113113

114-
import reactnative4 from '/src/fragments/lib/analytics/js/getting-started/30_initAnalytics.mdx';
114+
import reactnative4 from '/src/fragments/lib/analytics/native_common/getting-started/30_initAnalytics.mdx';
115115

116116
<Fragments fragments={{ 'react-native': reactnative4 }} />
117117

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Import and load the configuration file in your app. It's recommended you add the Amplify configuration step to your app's root entry point. For example `index.js` in React or `main.ts` in Angular.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Import and load the configuration file in your app. It's recommended you add the Amplify configuration step to your app's root entry point. For example, **App.js** (Expo) or **index.js** (React Native CLI).

src/fragments/lib/in-app-messaging/integrate-your-application/react-native/configure-amplify.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
### Configure Amplify
22

3-
Next, you should import and load the `aws-exports.js` configuration file created by the CLI. Add the Amplify configuration step to your application’s root entry point. For example, `index.js`.
3+
import rn1 from '/src/fragments/lib/common/react-native/import_configuration.mdx'
4+
5+
<Fragments fragments={{ 'react-native': rn1 }} />
46

57
```js
68
import { Amplify } from 'aws-amplify';

src/fragments/lib/interactions/js/frontend.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Import and load the configuration file in your app. It's recommended you add the Amplify configuration step to your app's root entry point. For example `App.js` in React or `main.ts` in Angular.
1+
import js0 from '/src/fragments/lib/common/js/import_configuration.mdx'
2+
3+
<Fragments fragments={{ js: js0 }} />
24

35
```javascript
46
import { Amplify, Interactions } from 'aws-amplify';

src/fragments/lib/interactions/js/getting-started.mdx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,23 @@ import { AWSLexV2Provider } from '@aws-amplify/interactions';
7777
Amplify.addPluggable(new AWSLexV2Provider());
7878

7979
const interactionsConfig = {
80-
Auth: {
81-
identityPoolId: "<identityPoolId>",
82-
region: "<region>"
83-
},
84-
Interactions: {
85-
bots: {
86-
// LexV2 Bot
87-
<V2BotName>: {
88-
name: "<V2BotName>",
89-
aliasId: "<V2BotAliasId>",
90-
botId: "<V2BotBotId>",
91-
localeId: "<V2BotLocaleId>",
92-
region: "<V2BotRegion>",
93-
providerName: "AWSLexV2Provider",
94-
},
95-
}
80+
Auth: {
81+
identityPoolId: "<identityPoolId>",
82+
region: "<region>"
83+
},
84+
Interactions: {
85+
bots: {
86+
// LexV2 Bot
87+
<V2BotName>: {
88+
name: "<V2BotName>",
89+
aliasId: "<V2BotAliasId>",
90+
botId: "<V2BotBotId>",
91+
localeId: "<V2BotLocaleId>",
92+
region: "<V2BotRegion>",
93+
providerName: "AWSLexV2Provider",
94+
},
9695
}
96+
}
9797
}
9898

9999
Amplify.configure(interactionsConfig);

src/fragments/lib/predictions/js/getting-started.mdx

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ A configuration file called `aws-exports.js` will be copied to your configured s
2222

2323
## Configure the frontend
2424

25-
Import and load the configuration file in your app. It's recommended you add the Amplify configuration step to your app's root entry point. For example `App.js` in React or `main.ts` in Angular.
25+
import js0 from '/src/fragments/lib/common/js/import_configuration.mdx'
26+
27+
<Fragments fragments={{ js: js0 }} />
28+
29+
import rn1 from '/src/fragments/lib/common/react-native/import_configuration.mdx'
30+
31+
<Fragments fragments={{ 'react-native': rn1 }} />
2632

2733
```javascript
2834
import { Amplify } from 'aws-amplify';
@@ -120,37 +126,37 @@ The Amplify CLI will set appropriate IAM policy for Roles in your Cognito Identi
120126

121127
```json
122128
{
123-
"Version": "2012-10-17",
124-
"Statement": [
125-
{
126-
"Effect": "Allow",
127-
"Action": [
128-
"translate:TranslateText",
129-
"polly:SynthesizeSpeech",
130-
"transcribe:StartStreamTranscriptionWebSocket",
131-
"comprehend:DetectSentiment",
132-
"comprehend:DetectEntities",
133-
"comprehend:DetectDominantLanguage",
134-
"comprehend:DetectSyntax",
135-
"comprehend:DetectKeyPhrases",
136-
"rekognition:DetectFaces",
137-
"rekognition:RecognizeCelebrities"
138-
"rekognition:DetectLabels",
139-
"rekognition:DetectModerationLabels",
140-
"rekognition:DetectText",
141-
"rekognition:DetectLabel",
142-
"textract:AnalyzeDocument",
143-
"textract:DetectDocumentText",
144-
"textract:GetDocumentAnalysis",
145-
"textract:StartDocumentAnalysis",
146-
"textract:StartDocumentTextDetection",
147-
"rekognition:SearchFacesByImage"
148-
],
149-
"Resource": [
150-
"*"
151-
]
152-
}
153-
]
129+
"Version": "2012-10-17",
130+
"Statement": [
131+
{
132+
"Effect": "Allow",
133+
"Action": [
134+
"translate:TranslateText",
135+
"polly:SynthesizeSpeech",
136+
"transcribe:StartStreamTranscriptionWebSocket",
137+
"comprehend:DetectSentiment",
138+
"comprehend:DetectEntities",
139+
"comprehend:DetectDominantLanguage",
140+
"comprehend:DetectSyntax",
141+
"comprehend:DetectKeyPhrases",
142+
"rekognition:DetectFaces",
143+
"rekognition:RecognizeCelebrities"
144+
"rekognition:DetectLabels",
145+
"rekognition:DetectModerationLabels",
146+
"rekognition:DetectText",
147+
"rekognition:DetectLabel",
148+
"textract:AnalyzeDocument",
149+
"textract:DetectDocumentText",
150+
"textract:GetDocumentAnalysis",
151+
"textract:StartDocumentAnalysis",
152+
"textract:StartDocumentTextDetection",
153+
"rekognition:SearchFacesByImage"
154+
],
155+
"Resource": [
156+
"*"
157+
]
158+
}
159+
]
154160
}
155161
```
156162

src/fragments/lib/restapi/js/getting-started.mdx

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ A configuration file called `aws-exports.js` will be copied to your configured s
3434

3535
### Configure your application
3636

37-
Import and load the configuration file in your app. It's recommended you add the Amplify configuration step to your app's root entry point. For example `App.js` in React or `main.ts` in Angular.
37+
import js0 from '/src/fragments/lib/common/js/import_configuration.mdx'
38+
39+
<Fragments fragments={{ js: js0 }} />
40+
41+
import rn1 from '/src/fragments/lib/common/react-native/import_configuration.mdx'
42+
43+
<Fragments fragments={{ 'react-native': rn1 }} />
3844

3945
```javascript
4046
import { Amplify, API } from 'aws-amplify';
@@ -51,26 +57,26 @@ For manual configuration you need to provide your AWS Resource configuration and
5157
import { Amplify, API } from 'aws-amplify';
5258

5359
Amplify.configure({
54-
// OPTIONAL - if your API requires authentication
55-
Auth: {
56-
identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab', // REQUIRED - Amazon Cognito Identity Pool ID
57-
region: 'XX-XXXX-X', // REQUIRED - Amazon Cognito Region
58-
userPoolId: 'XX-XXXX-X_abcd1234', // OPTIONAL - Amazon Cognito User Pool ID
59-
userPoolWebClientId: 'a1b2c3d4e5f6g7h8i9j0k1l2m3', // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
60-
},
61-
API: {
62-
endpoints: [
63-
{
64-
name: "MyAPIGatewayAPI",
65-
endpoint: "https://1234567890-abcdefgh.amazonaws.com"
66-
},
67-
{
68-
name: "MyCustomCloudFrontApi",
69-
endpoint: "https://api.my-custom-cloudfront-domain.com",
70-
71-
}
72-
]
73-
}
60+
// OPTIONAL - if your API requires authentication
61+
Auth: {
62+
identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab', // REQUIRED - Amazon Cognito Identity Pool ID
63+
region: 'XX-XXXX-X', // REQUIRED - Amazon Cognito Region
64+
userPoolId: 'XX-XXXX-X_abcd1234', // OPTIONAL - Amazon Cognito User Pool ID
65+
userPoolWebClientId: 'a1b2c3d4e5f6g7h8i9j0k1l2m3', // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
66+
},
67+
API: {
68+
endpoints: [
69+
{
70+
name: "MyAPIGatewayAPI",
71+
endpoint: "https://1234567890-abcdefgh.amazonaws.com"
72+
},
73+
{
74+
name: "MyCustomCloudFrontApi",
75+
endpoint: "https://api.my-custom-cloudfront-domain.com",
76+
77+
}
78+
]
79+
}
7480
});
7581
```
7682

@@ -82,14 +88,14 @@ You can utilize regional endpoints by passing in the *service* and *region* info
8288

8389
```javascript
8490
API: {
85-
endpoints: [
86-
{
87-
name: "MyCustomLambda",
88-
endpoint: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/yourFuncName/invocations",
89-
service: "lambda",
90-
region: "us-east-1"
91-
}
92-
]
91+
endpoints: [
92+
{
93+
name: "MyCustomLambda",
94+
endpoint: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/yourFuncName/invocations",
95+
service: "lambda",
96+
region: "us-east-1"
97+
}
98+
]
9399
}
94100
```
95101
<Callout warning>

0 commit comments

Comments
 (0)