@amplifyup/sdk 0.2.5 → 0.3.1-uat.104.gfd92fe0

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/README.md CHANGED
@@ -121,9 +121,10 @@ The generated `.amplifyup` folder ignores itself in git. Don't edit it.
121
121
 
122
122
  ### Without the Next plugin
123
123
 
124
- For CI steps or non-Next builds, run the CLI before your build:
124
+ The SDK has no command of its own. For CI steps or non-Next builds, install [`@amplifyup/cli`](https://www.npmjs.com/package/@amplifyup/cli) and run it before your build:
125
125
 
126
126
  ```bash
127
+ npm install --save-dev @amplifyup/cli
127
128
  npx amplifyup registry # build once
128
129
  npx amplifyup registry --watch # rebuild as files are added, renamed or removed
129
130
  ```
@@ -134,6 +135,17 @@ If a page uses a component that isn't in your registry, Composer shows a placeho
134
135
 
135
136
  ---
136
137
 
138
+ ## Upgrading to 0.3
139
+
140
+ 0.3 removes the `amplifyup` command from this package. Nothing else changes.
141
+
142
+ | You use | Do this |
143
+ | --- | --- |
144
+ | `withAmplifyUp` in `next.config` | Nothing. The plugin still builds your registry. |
145
+ | `amplifyup registry` in a script or CI step | `npm install --save-dev @amplifyup/cli`. The same command and flags now come from there. |
146
+
147
+ ---
148
+
137
149
  ## Upgrading from 0.1
138
150
 
139
151
  0.2.0 removes hand-written rendering. `renderComponent` and the `ComponentContextProvider` export are gone, and passing `renderComponent` throws an error that points here.
@@ -656,6 +668,22 @@ track('Product Viewed', { productId: '123' });
656
668
  identify('user-123', { email: 'user@example.com' });
657
669
  ```
658
670
 
671
+ ## Visitor consent
672
+
673
+ Tell Amplify UP what your consent banner learned, so form answers are only kept for visitors who agreed:
674
+
675
+ ```typescript
676
+ import { setConsent } from '@amplifyup/sdk';
677
+
678
+ // When the visitor accepts or rejects in your banner:
679
+ setConsent('granted'); // or 'denied'
680
+
681
+ // To forget the choice:
682
+ setConsent(null);
683
+ ```
684
+
685
+ The choice is remembered in the browser and sent with every form submission. Then turn on **My consent banner tells Amplify UP** under Forms › Visitor consent. Until you do, Amplify UP treats a visitor who agreed the same as one who didn't, and keeps no answers for either.
686
+
659
687
  ## Debugging
660
688
 
661
689
  ```js
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
- import { P as PageConfig } from './types-ffQNIQCK.mjs';
3
+ import { P as PageConfig } from './types-CxucvIL6.mjs';
4
4
 
5
5
  declare const REGISTRY_BRAND: unique symbol;
6
6
  type SiteComponent = ComponentType<any>;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
- import { P as PageConfig } from './types-ffQNIQCK.js';
3
+ import { P as PageConfig } from './types-CxucvIL6.js';
4
4
 
5
5
  declare const REGISTRY_BRAND: unique symbol;
6
6
  type SiteComponent = ComponentType<any>;
@@ -1,3 +1,3 @@
1
1
  import 'react';
2
- export { A as AmplifyRenderer } from './AmplifyRenderer-eGtn5k9_.mjs';
3
- import './types-ffQNIQCK.mjs';
2
+ export { A as AmplifyRenderer } from './AmplifyRenderer-CwAYY8K1.mjs';
3
+ import './types-CxucvIL6.mjs';
@@ -1,3 +1,3 @@
1
1
  import 'react';
2
- export { A as AmplifyRenderer } from './AmplifyRenderer-CTwblDs3.js';
3
- import './types-ffQNIQCK.js';
2
+ export { A as AmplifyRenderer } from './AmplifyRenderer-D40crBWY.js';
3
+ import './types-CxucvIL6.js';
@@ -3767,7 +3767,7 @@ var assertComponentRegistry = (owner, props) => {
3767
3767
  }
3768
3768
  if (!isComponentRegistry(props.registry)) {
3769
3769
  throw new Error(
3770
- `[Amplify UP] ${owner} needs your component registry. Render <AmplifyPage /> from the generated .amplifyup/component-registry module (created by withAmplifyUp or \`amplifyup registry\`).`
3770
+ `[Amplify UP] ${owner} needs your component registry. Render <AmplifyPage /> from the generated .amplifyup/component-registry module (created by withAmplifyUp or \`amplifyup registry\` from @amplifyup/cli).`
3771
3771
  );
3772
3772
  }
3773
3773
  };