Skip to content

Commit

Permalink
Merge main into next-release/main (#7030)
Browse files Browse the repository at this point in the history
* Minor edits to Vite + React quickstart (#6926)

* Updates to Vite + React quickstart

* Update src/fragments/gen2/quickstart/build-a-backend.mdx

Co-authored-by: Kevin Old <kevold@amazon.com>

* Update build-a-backend.mdx

* Update build-a-backend.mdx

* Update build-a-backend.mdx

---------

Co-authored-by: Kevin Old <kevold@amazon.com>

* fix: Fix incorrect auth import path in migration guide. (#6934)

* fix: Update incorrect `updateMFAPreference` parameter in JS v6 migration guide. (#6935)

* Amplify Android Release 2.14.11 (#6933)

* chore: refactor .layout-header into separate component (#6826)

* platform typed as optional

* refactor init

* remove commented code

* remove angry useEffect

* fix typing

* added layoutcontext so mobile menu closes on navigation

* move import

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* fix: Nesting of auth cli templates (#6932)

* fix: change config variable name (#6923)

* Guide to support Amplify v2 with AWS Android SDK (#6927)

* Update puppeteer (#6949)

* Update index.mdx (#6950)

* Update CODEOWNERS with correct PM alignment (#6951)

* fix(flutter, js): scope "connect existing cdk" guide to respective platform (#6947)

Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>

* Revert "fix(flutter, js): scope "connect existing cdk" guide to respective pl…" (#6955)

This reverts commit 5998b22.

* chore: remove duplicated logic between Layout and LayoutHeader (#6954)

* chore: more layout refactoring

* remove unused prop, alphabetize props

* improve oauth docs (#6961)

* fixed gen 2 getting started guide (#6968)

* Update redirects for deleted hidden pages (#6944)

* Update manual installation to point to @beta tag (#6972)

* include usage for multi-page apps (#6964)

* include usage for multi-page apps

* improve multi-page app docs

* use Hub syntax

* update imports in examples

* chore: Clean up broken Amplify JS API reference links (#6976)

* chore: Clean up broken Amplify JS API reference links.

* Cleaned up language.

* Update build image instructions for Gen 2 (#6978)

* update build image settings for Gen 2

* remove callout and add fragment to vite guide

* chore: add unit test for YoutubeEmbed component (#6983)

* chore: add unit test for YoutubeEmbed component

* add code coverage stats

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for Accordion component (#6981)

* chore: add unit tests for Accordion component

* issue with window properties

* fixed tracking test

* working on animation issue

* accordion tests

* fix testing errors

* added test for closing accordion

* add code coverage stats

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* Update index.mdx (#6986)

* Add env variables for algolia (#6957)

* Add algolia env vars to next.config

* Remove extra code string

* fix(data): update REST API docs to document correct error response type (#6989)

* fix(data): update React Native minimum iOS deployment target guidance; add build step to docs (#6970)

* fix(data): update React Native minimum iOS deployment target; add build step to docs

* address PR feedback

* remove deployment target guidance

* add React Native version deployment target callout

* fix unrecognized syntax

* replace callout with accordion

* move 'upgrading' callout

* Clarify behavior of forgetDevice() API regarding device tracking (#6985)

* Clarify behavior of forgetDevice() API regarding device tracking

This commit updates the documentation to clarify that using the forgetDevice() API results in the device being neither remembered nor tracked. Previously, the documentation suggested that forgotten devices might still be tracked, leading to confusion about the API's behavior. The revised wording aligns with the detailed description under the "Forgotten" section, ensuring consistency and eliminating ambiguity about how forgotten devices are handled.

* Clarify behavior of forgetDevice() API regarding device tracking

* Support for enum value listing (#6885)

* Support for enum value listing

* Update src/pages/gen2/build-a-backend/data/data-modeling/add-fields/index.mdx

* CDK updates v2 (#6990)

* Add padding to bottom of nav menu (#6991)

* Adding secondary index to Gen 2 (#6996)

* Adding secondary index docs

* fixed some formatting for custom query fields

* extend config to show addOuput (#6963)

* extend config

* modify wording

* modify example

* improve wording

* Update index.mdx (#6995)

* Update index.mdx

* add guest access support to docs

* chore: add unit tests for NextPrevious component (#7003)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for LinkCards and LinkCard components (#7006)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for GetStartedPopover component (#7005)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* fix: [Storage] Configure Access (#6948)

Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>

* fix(Swift): update data use policy info's tracking to false (#6938)

* fix(Swift): update data use policy info's tracking to false

* Update data-information.mdx

* chore: add callouts and troubleshooting guide for configuration (#6967)

* fix: resolve in-content broken links (#7011)

* re-platforming

* remove reference to mocking and testing for android & swift

* remove reference to mocking and testing for android & swift

* filtered out reference to optimistic ui for react native

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* update gen2 storage and function docs (#7009)

* update gen2 storage and function docs

* add resource access links and example

* revisions, update code snippet titles

* Update CODEOWNERS (#7014)

* updated steps for extending components in code (#6827)

Co-authored-by: Aditya Shahani <theadi@amazon.com>

* Custom business logic support as of March @beta (#7019)

* Enhanced custom business logic DX

* addressed tim's comments

* Added custom subscription configuration worfklow

* removed in-development areas

* added titles

* added links for deep dive material

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <ykethan@amazon.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <ykethan@amazon.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

* added client method for clarity.

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <ykethan@amazon.com>

* Apply suggestions from code review

Co-authored-by: josef <josef.aidt@gmail.com>

---------

Co-authored-by: josef <josef.aidt@gmail.com>
Co-authored-by: Kethan sai <ykethan@amazon.com>

* add storage trigger docs (#7020)

* storage trigger docs

* Apply suggestions from code review

Co-authored-by: josef <josef.aidt@gmail.com>

* add storage access actions

---------

Co-authored-by: josef <josef.aidt@gmail.com>

* update link checker to wait for each call to complete before making t… (#6993)

* update link checker to wait for each call to complete before making the next and remove # from urls being checked

* update logging to show how many links found on each page

* Update tasks/link-checker.js

---------

Co-authored-by: Jacob Logan <lognjc@amazon.com>
Co-authored-by: katiegoines <katiegoines@gmail.com>
Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>

* custom examples (#6979)

* custom examples

* fix: broken link, missing / at start (#7026)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* validate and fix code snippets in Data section (#6975)

* Move src/pages/gen2/build-a-backend/add-aws-services/analytics/index.mdx

* git mv src/pages/gen2/build-a-backend/add-aws-services/geo/index.mdx

* git mv src/pages/gen2/build-a-backend/add-aws-services/in-app-messaging/index.mdx

* git mv src/pages/gen2/build-a-backend/add-aws-services/rest-api/index.mdx

* Merge main

* Remove file, accidentally merged it into base path when it should've been in gen1

* Add platforms to new pages

---------

Co-authored-by: Jim Eagan <84857865+hibler13@users.noreply.github.com>
Co-authored-by: Kevin Old <kevold@amazon.com>
Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com>
Co-authored-by: Ankit Shah <22114629+ankpshah@users.noreply.github.com>
Co-authored-by: Katie Goines <30757403+katiegoines@users.noreply.github.com>
Co-authored-by: katiegoines <katiegoines@gmail.com>
Co-authored-by: Dan Kiuna <dankiuna@gmail.com>
Co-authored-by: Kihara, Takuya <gray@tacck.net>
Co-authored-by: Tyler Roach <tjroach@amazon.com>
Co-authored-by: Rene Brandel <4989523+renebrandel@users.noreply.github.com>
Co-authored-by: Elijah Quartey <Equartey@users.noreply.github.com>
Co-authored-by: Heather Buchel <hbuchel@gmail.com>
Co-authored-by: John Corser <johnpc@umich.edu>
Co-authored-by: Heather Pundt <119376175+heatheramz@users.noreply.github.com>
Co-authored-by: Nikhil Swaminathan <2429410+swaminator@users.noreply.github.com>
Co-authored-by: Jay Raval <jay.ambrish.raval@gmail.com>
Co-authored-by: David McAfee <mcafd@amazon.com>
Co-authored-by: Kethan sai <ykethan@amazon.com>
Co-authored-by: Michael Law <1365977+lawmicha@users.noreply.github.com>
Co-authored-by: erinleigh90 <106691284+erinleigh90@users.noreply.github.com>
Co-authored-by: Edward Foyle <foyleef@amazon.com>
Co-authored-by: Adi <34354177+the1adi@users.noreply.github.com>
Co-authored-by: Aditya Shahani <theadi@amazon.com>
Co-authored-by: josef <josef.aidt@gmail.com>
Co-authored-by: jacoblogan <jacob.maiola.logan@gmail.com>
Co-authored-by: Jacob Logan <lognjc@amazon.com>
Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>
Co-authored-by: Chris Bonifacio <christopher.bonifacio@gmail.com>
  • Loading branch information
1 parent 5fba6ee commit 087afa9
Show file tree
Hide file tree
Showing 29 changed files with 1,227 additions and 354 deletions.
12 changes: 12 additions & 0 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ export const directory = {
},
{
path: 'src/pages/[platform]/build-a-backend/add-aws-services/overriding-resources/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/add-aws-services/rest-api/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/add-aws-services/in-app-messaging/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/add-aws-services/analytics/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/add-aws-services/geo/index.mdx'
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { getCustomStaticPath } from '@/utils/getCustomStaticPath';

export const meta = {
title: 'Analytics',
description: 'Learn how to set Analytics resource powered by Pinpoint',
platforms: [
'android',
'angular',
'flutter',
'javascript',
'nextjs',
'react',
'react-native',
'swift',
'vue'
]
};

export const getStaticPaths = async () => {
return getCustomStaticPath(meta.platforms);
};

export function getStaticProps(context) {
return {
props: {
meta
}
};
}

<Callout warning>

**Under active development:** The `addOutput` method for Amplify (Gen 2) is under active development. The experience may change between versions of `@aws-amplify/backend`. Try it out and provide feedback at https://github.com/aws-amplify/amplify-backend/issues/new/choose

</Callout>

Amplify enables you to collect analytics data for your app. The Analytics category uses Amazon Cognito Identity pools to _identify_ users in your app.
The following is an example utilizing the [AWS Cloud Development Kit (AWS CDK)](https://docs.aws.amazon.com/cdk/latest/guide/home.html) to create the an Analytics resource powered by [Amazon Pinpoint](https://aws.amazon.com/pinpoint/).

```ts title="amplify/backend.ts"
import { Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
import { CfnApp } from "aws-cdk-lib/aws-pinpoint";

const backend = defineBackend({
auth,
data,
// additional resources
});

const analyticsStack = backend.createStack("analytics-stack");

// create a Pinpoint app
const pinpoint = new CfnApp(analyticsStack, "Pinpoint", {
name: "myPinpointApp",
});

// create an IAM policy to allow interacting with Pinpoint
const pinpointPolicy = new Policy(analyticsStack, "PinpointPolicy", {
policyName: "PinpointPolicy",
statements: [
new PolicyStatement({
actions: ["mobiletargeting:UpdateEndpoint", "mobiletargeting:PutEvents"],
resources: [pinpoint.attrArn + "/*"],
}),
],
});

// apply the policy to the authenticated and unauthenticated roles
backend.auth.resources.authenticatedUserIamRole.attachInlinePolicy(pinpointPolicy);
backend.auth.resources.unauthenticatedUserIamRole.attachInlinePolicy(pinpointPolicy);

// patch the custom Pinpoint resource to the expected output configuration
backend.addOutput({
Analytics: {
AWSPinpoint: {
appId: pinpoint.ref,
region: Stack.of(pinpoint).region,
},
},
});
```

### Initialize Analytics

To initialize Analytics you need to configure Amplify with `Amplify.configure()`

### Working with Analytics

Refer to the [Analytics documentation](/react/build-a-backend/more-features/analytics/) to learn how to track events and user sessions in your app.

### References

[Amazon Pinpoint Construct Library](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_pinpoint-readme.html)
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,20 @@ type CustomNotificationsProps = {
};

export class CustomNotifications extends Construct {
public readonly topic: sns.Topic;
constructor(scope: Construct, id: string, props: CustomNotificationsProps) {
super(scope, id);

const { sourceAddress } = props;

// Create SNS topic
const topic = new sns.Topic(this, 'NotificationTopic');
this.topic = new sns.Topic(this, 'NotificationTopic');

// Create Lambda to publish messages to SNS topic
const publisher = new lambda.NodejsFunction(this, 'Publisher', {
entry: url.fileURLToPath(new URL('publisher.ts', import.meta.url)),
environment: {
SNS_TOPIC_ARN: topic.topicArn
SNS_TOPIC_ARN: this.topic.topicArn
},
runtime: Runtime.NODEJS_18_X
});
Expand All @@ -147,10 +148,10 @@ export class CustomNotifications extends Construct {
});

// Subscribe emailer Lambda to SNS topic
topic.addSubscription(new subscriptions.LambdaSubscription(emailer));
this.topic.addSubscription(new subscriptions.LambdaSubscription(emailer));

// Allow publisher to publish to SNS topic
topic.grantPublish(publisher);
this.topic.grantPublish(publisher);
}
}
```
Expand Down Expand Up @@ -246,11 +247,18 @@ const backend = defineBackend({
data
});

new CustomNotifications(
const customNotifications = new CustomNotifications(
backend.createStack('CustomNotifications'),
'CustomNotifications',
{ sourceAddress: 'sender@example.com' }
);

backend.addOutput({
custom: {
topicArn: customNotifications.topic.topicArn,
topicName: customNotifications.topic.topicName,
},
});
```

## Community CDK resources
Expand Down
114 changes: 114 additions & 0 deletions src/pages/[platform]/build-a-backend/add-aws-services/geo/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import { getCustomStaticPath } from '@/utils/getCustomStaticPath';

export const meta = {
title: 'Geo',
description: 'Learn how to set up Geo resource powered by Amazon Location Services.',
platforms: [
'android',
'angular',
'flutter',
'javascript',
'nextjs',
'react',
'react-native',
'swift',
'vue'
]
};

export const getStaticPaths = async () => {
return getCustomStaticPath(meta.platforms);
};

export function getStaticProps(context) {
return {
props: {
meta
}
};
}

<Callout warning>

**Under active development:** The `addOutput` method for Amplify (Gen 2) is under active development. The experience may change between versions of `@aws-amplify/backend`. Try it out and provide feedback at https://github.com/aws-amplify/amplify-backend/issues/new/choose

</Callout>

Amplify provides APIs and map UI components for maps and location search for your web apps. The following is an example utilizing the [AWS Cloud Development Kit (AWS CDK)](https://docs.aws.amazon.com/cdk/latest/guide/home.html) to create a Geo resource powered by [Amazon Location Services](https://aws.amazon.com/location/).

```ts title="amplify/backend.ts"
import { CfnMap } from "aws-cdk-lib/aws-location";

const backend = defineBackend({
auth,
data,
// additional resources
});

const geoStack = backend.createStack("geo-stack");

// create a location services map
const map = new CfnMap(geoStack, "Map", {
mapName: "myMap",
description: "Map",
configuration: {
style: "VectorEsriNavigation",
},
pricingPlan: "RequestBasedUsage",
tags: [
{
key: "name",
value: "myMap",
},
],
});

// create an IAM policy to allow interacting with geo resource
const myGeoPolicy = new Policy(geoStack, "AuthenticatedUserIamRolePolicy", {
policyName: "GeoPolicy",
statements: [
new PolicyStatement({
actions: [
"geo:GetMapTile",
"geo:GetMapSprites",
"geo:GetMapGlyphs",
"geo:GetMapStyleDescriptor",
],
resources: [map.attrArn],
}),
],
});

// apply the policy to the authenticated and unauthenticated roles
backend.auth.resources.authenticatedUserIamRole.attachInlinePolicy(myGeoPolicy);
backend.auth.resources.unauthenticatedUserIamRole.attachInlinePolicy(myGeoPolicy);

// patch the custom map resource to the expected output configuration
backend.addOutput({
geo: {
amazon_location_service: {
region: Stack.of(geoStack).region,
maps: {
items: {
[map.mapName]: {
style: "VectorEsriNavigation",
},
},
default: map.mapName,
},
},
},
});
```

### Initialize Geo

To initialize Geo you need to configure Amplify with `Amplify.configure()`

### Working with Maps

To display a map in your React app, you can use the [Amplify React MapView component](https://ui.docs.amplify.aws/react/components/geo) or the [MapLibre GL](https://github.com/maplibre/maplibre-gl-js) with `maplibre-gl-js-amplify` libraries are required. Refer to the [Amplify Geo documentation](/react/build-a-backend/more-features/geo/maps/) for more information.

### References

[Location Construct Library](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_location-readme.html)
Loading

0 comments on commit 087afa9

Please sign in to comment.