|
| 1 | +# App SDK v2.0.0 Migration Guide |
| 2 | + |
| 3 | +With the release of **App SDK version 2.0.0**, certain breaking changes have been introduced to enhance the SDK's functionality and structure. To ensure a smooth transition to the new version, please follow the migration instructions below: |
| 4 | + |
| 5 | +## Managing Metadata Response Changes |
| 6 | + |
| 7 | +If your application previously utilized the metadata module's methods to handle app metadata, you'll need to update your approach for handling the response structure. |
| 8 | + |
| 9 | +Make note of the updated response structures for the following methods: |
| 10 | + |
| 11 | +##### `createMetaData()` |
| 12 | + |
| 13 | +##### `retrieveMetaData()` |
| 14 | + |
| 15 | +##### `retrieveAllMetaData()` |
| 16 | + |
| 17 | +##### `updateMetaData()` |
| 18 | + |
| 19 | +##### `deleteMetaData()` |
| 20 | + |
| 21 | +Here's a comparison of the old and new response structures: |
| 22 | + |
| 23 | +#### Older Response (Version 1.x): |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + data: { |
| 28 | + metadata: {} // Actual metadata response to be returned, |
| 29 | + }, |
| 30 | + origin: app.contentstack.com, // origin where the app is running |
| 31 | + source: global{} // Source information |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +#### Newer Response (Version 2.0.0): |
| 36 | + |
| 37 | +```json |
| 38 | +{ |
| 39 | + "metadata": {} // Actual metadata response to be returned, |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +## Field Modifier and Full Page Location Changes |
| 44 | + |
| 45 | +If you were utilizing the `EntryFieldLocation` and `FullscreenAppWidget` properties to manage your field modifier or full page applications, it's essential to adapt to the new property names introduced in version 2.0.0: |
| 46 | + |
| 47 | +Replace occurrences of `appSDK.location.EntryFieldLocation` with `appSDK.location.FieldModifierLocation`. |
| 48 | + |
| 49 | +Replace occurrences of `appSDK.location.FullscreenAppWidget` with `appSDK.location.FullPage`. |
| 50 | + |
| 51 | +## Update for `_extension` Property |
| 52 | + |
| 53 | +In prior versions of the App SDK, the `_extension` property was available on the App SDK instance returned after initialization. In version 2.0.0, this property has been replaced with `_uiLocation`. Make the following adjustment in your code: |
| 54 | + |
| 55 | +Replace `appSdk._extension` with `appSdk._uiLocation`. |
| 56 | + |
| 57 | +Here's an example of how the change can be applied: |
| 58 | + |
| 59 | +```javascript |
| 60 | +ContentstackAppSDK.init((appSdk) => { |
| 61 | + // Previous version |
| 62 | + appSdk._extension; // No longer available |
| 63 | + |
| 64 | + // Updated version |
| 65 | + appSdk._uiLocation; // Instance of the UiLocation |
| 66 | +}); |
| 67 | +``` |
| 68 | + |
| 69 | +These migration instructions will help you seamlessly transition to App SDK version 2.0.0. Should you have any questions or need further assistance, please don't hesitate to reach out. |
0 commit comments