@frontify/guideline-blocks-settings 0.30.2 → 0.31.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @frontify/guideline-blocks-settings
2
2
 
3
+ ## 0.31.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#708](https://github.com/Frontify/brand-sdk/pull/708) [`e2a0023`](https://github.com/Frontify/brand-sdk/commit/e2a0023256001dcc64a597f6dcd9df66a1c9f186) Thanks [@ragi96](https://github.com/ragi96)! - feat: add support for @frontify/app-bridge 4.0.0-alpha.0
8
+
9
+ - Updated dependencies [[`c98d8c4`](https://github.com/Frontify/brand-sdk/commit/c98d8c414b2cdd00d4945f0c29581370b0a7daa0)]:
10
+ - @frontify/app-bridge@3.0.4
11
+
12
+ ## 0.31.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#698](https://github.com/Frontify/brand-sdk/pull/698) [`1003fea`](https://github.com/Frontify/brand-sdk/commit/1003feab2b08e4cc4db5629306e2f25cda8bae86) Thanks [@ragi96](https://github.com/ragi96)! - feat: move @frontify/app-bridge to peer dependencies
17
+
18
+ ### Patch Changes
19
+
20
+ - [#697](https://github.com/Frontify/brand-sdk/pull/697) [`759188b`](https://github.com/Frontify/brand-sdk/commit/759188b28219e23ef7ce19edbc2d5e3248270ea8) Thanks [@fulopdaniel](https://github.com/fulopdaniel)! - chore: bumps @frontify/fondue to 12.0.0-beta.396
21
+
22
+ - Updated dependencies [[`759188b`](https://github.com/Frontify/brand-sdk/commit/759188b28219e23ef7ce19edbc2d5e3248270ea8)]:
23
+ - @frontify/sidebar-settings@0.9.1
24
+
3
25
  ## 0.30.2
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -58,3 +58,17 @@ import '@frontify/guideline-blocks-settings/styles';
58
58
  ## Development
59
59
 
60
60
  Run `pnpm build` to make changes directly available to the linked packages.
61
+
62
+ To run the tests, linter, or type checker, first update @frontify/app-bridge. For the latest version, execute:
63
+
64
+ ```
65
+ pnpm add @frontify/app-bridge@workspace:^ --filter {packages/guideline-blocks-settings}
66
+ ```
67
+
68
+ For a specific version, such as 3.0.2, execute:
69
+
70
+ ```
71
+ pnpm add @frontify/app-bridge@3.0.2 --filter {packages/guideline-blocks-settings}
72
+ ```
73
+
74
+ After updating, you can run the following commands as needed. For testing, use `pnpm test`. For linting, use `pnpm lint`. For type checking, use `pnpm typecheck`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontify/guideline-blocks-settings",
3
- "version": "0.30.2",
3
+ "version": "0.31.1",
4
4
  "description": "Provides types and helpers for the guideline block development",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.umd.js",
@@ -56,16 +56,16 @@
56
56
  "@dnd-kit/core": "^6.1.0",
57
57
  "@dnd-kit/modifiers": "^7.0.0",
58
58
  "@dnd-kit/sortable": "^8.0.0",
59
- "@frontify/fondue": "12.0.0-beta.395",
59
+ "@frontify/fondue": "12.0.0-beta.396",
60
60
  "@react-aria/focus": "^3.14.0",
61
61
  "@react-stately/overlays": "^3.6.1",
62
62
  "@udecode/plate": "^21.5.0",
63
63
  "slate": "^0.94.1",
64
64
  "slate-react": "^0.98.3",
65
- "@frontify/app-bridge": "^3.0.2",
66
- "@frontify/sidebar-settings": "^0.9.0"
65
+ "@frontify/sidebar-settings": "^0.9.1"
67
66
  },
68
67
  "peerDependencies": {
68
+ "@frontify/app-bridge": "^3.0.0",
69
69
  "react": "^18",
70
70
  "react-dom": "^18"
71
71
  },
@@ -1,9 +1,10 @@
1
1
  /* (c) Copyright Frontify Ltd., all rights reserved. */
2
2
 
3
- import { AssetDummy, getAppBridgeBlockStub } from '@frontify/app-bridge';
3
+ import { type AppBridgeBlock, AssetDummy, getAppBridgeBlockStub } from '@frontify/app-bridge';
4
4
  import { mount } from 'cypress/react18';
5
5
  import { Attachments as AttachmentsComponent } from './Attachments';
6
6
  import { AttachmentsProps } from './types';
7
+ import { SinonStub } from 'sinon';
7
8
 
8
9
  const FlyoutButtonSelector = '[data-test-id="attachments-flyout-button"]';
9
10
  const AssetInputSelector = '[data-test-id="asset-input-placeholder"]';
@@ -37,6 +38,17 @@ const Attachments = ({
37
38
  );
38
39
  };
39
40
 
41
+ const isPre302Stub = async (appBridge: AppBridgeBlock): Promise<boolean> => {
42
+ const context = appBridge.context();
43
+ return context === undefined;
44
+ };
45
+
46
+ const hasOpenAssetChooser = (
47
+ appBridge: AppBridgeBlock,
48
+ ): appBridge is AppBridgeBlock & { openAssetChooser: SinonStub } => {
49
+ return 'openAssetChooser' in appBridge;
50
+ };
51
+
40
52
  describe('Attachments', () => {
41
53
  it('renders attachments flyout if it is in edit mode', () => {
42
54
  mount(<Attachments appBridge={getAppBridgeBlockStub({ editorState: true })} />);
@@ -83,11 +95,15 @@ describe('Attachments', () => {
83
95
  cy.get(AttachmentItemSelector).should('have.length', 3);
84
96
  });
85
97
 
86
- it('renders loading circle for attachment item', () => {
98
+ it('renders loading circle for attachment item', async () => {
87
99
  const appBridge = getAppBridgeBlockStub({
88
100
  editorState: true,
89
101
  });
90
102
 
103
+ if ((await isPre302Stub(appBridge)) && hasOpenAssetChooser(appBridge)) {
104
+ (appBridge.openAssetChooser as SinonStub) = cy.stub().callsArgWith(0, AssetDummy.with(4));
105
+ }
106
+
91
107
  cy.clock();
92
108
  const replaceStub = () =>
93
109
  new Promise<void>((resolve) =>