@wix/workspace 1.0.0

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.
Files changed (40) hide show
  1. package/README.md +8 -0
  2. package/dist/cjs/external-types.d.js +2 -0
  3. package/dist/cjs/external-types.d.js.map +1 -0
  4. package/dist/cjs/index.js +9 -0
  5. package/dist/cjs/index.js.map +1 -0
  6. package/dist/cjs/items-selection/itemSelector.js +17 -0
  7. package/dist/cjs/items-selection/itemSelector.js.map +1 -0
  8. package/dist/cjs/items-selection/types.js +4 -0
  9. package/dist/cjs/items-selection/types.js.map +1 -0
  10. package/dist/cjs/legacy.js +21 -0
  11. package/dist/cjs/legacy.js.map +1 -0
  12. package/dist/cjs/test-types.d.js +2 -0
  13. package/dist/cjs/test-types.d.js.map +1 -0
  14. package/dist/cjs/types.js +4 -0
  15. package/dist/cjs/types.js.map +1 -0
  16. package/dist/esm/external-types.d.js +2 -0
  17. package/dist/esm/external-types.d.js.map +1 -0
  18. package/dist/esm/index.js +5 -0
  19. package/dist/esm/index.js.map +1 -0
  20. package/dist/esm/items-selection/itemSelector.js +13 -0
  21. package/dist/esm/items-selection/itemSelector.js.map +1 -0
  22. package/dist/esm/items-selection/types.js +2 -0
  23. package/dist/esm/items-selection/types.js.map +1 -0
  24. package/dist/esm/legacy.js +17 -0
  25. package/dist/esm/legacy.js.map +1 -0
  26. package/dist/esm/test-types.d.js +2 -0
  27. package/dist/esm/test-types.d.js.map +1 -0
  28. package/dist/esm/types.js +2 -0
  29. package/dist/esm/types.js.map +1 -0
  30. package/dist/types/index.d.ts +9 -0
  31. package/dist/types/index.d.ts.map +1 -0
  32. package/dist/types/items-selection/itemSelector.d.ts +3 -0
  33. package/dist/types/items-selection/itemSelector.d.ts.map +1 -0
  34. package/dist/types/items-selection/types.d.ts +55 -0
  35. package/dist/types/items-selection/types.d.ts.map +1 -0
  36. package/dist/types/legacy.d.ts +3 -0
  37. package/dist/types/legacy.d.ts.map +1 -0
  38. package/dist/types/types.d.ts +21 -0
  39. package/dist/types/types.d.ts.map +1 -0
  40. package/package.json +73 -0
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # workspace
2
+
3
+ Library flow package generated with Yoshi.
4
+
5
+ ## Useful URLs
6
+
7
+ - [Yoshi Library Flow Docs](https://bo.wix.com/pages/yoshi/docs/library-flow/overview)
8
+ - [Falcon Packages Guide Docs](https://dev.wix.com/docs/rnd-general/devex/falcon/guide/packages)
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/yoshi-flow-library/types" />
2
+ //# sourceMappingURL=external-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/external-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/yoshi-flow-library/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.legacy = exports.itemSelector = void 0;
5
+ var _legacy2 = require("./legacy.js");
6
+ var _itemSelector2 = require("./items-selection/itemSelector.js");
7
+ const itemSelector = exports.itemSelector = _itemSelector2.itemSelector;
8
+ const legacy = exports.legacy = _legacy2.legacy;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_legacy2","require","_itemSelector2","itemSelector","exports","_itemSelector","legacy","_legacy"],"sources":["../../src/index.ts"],"sourcesContent":["import { legacy as _legacy } from './legacy.js';\nimport { itemSelector as _itemSelector } from './items-selection/itemSelector.js';\nimport type { ExposeFieldsBasedOnToggle } from '@wix/sdk-types';\n\nexport const itemSelector = _itemSelector;\n\nexport const legacy: ExposeFieldsBasedOnToggle<\n typeof _legacy,\n { getContextIds: 'alpha' }\n> = _legacy;\n\nexport type { WorkspaceHost } from './types.js';\n\nexport type {\n ItemSelection,\n ItemSelectionOptions,\n ItemSelectionResult,\n Item,\n} from './items-selection/types.js';\n"],"mappings":";;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAGO,MAAME,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAGE,2BAAa;AAElC,MAAMC,MAGZ,GAAAF,OAAA,CAAAE,MAAA,GAAGC,eAAO","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.itemSelector = void 0;
5
+ var _hostModules = require("@wix/sdk-runtime/host-modules");
6
+ const itemSelector = exports.itemSelector = (0, _hostModules.createHostModule)({
7
+ openItemSelector: host => (...args) => {
8
+ if (!host.workspace) {
9
+ throw new Error('workspace is not available on the current host. Make sure to use an updated version of the host initialization package.');
10
+ }
11
+ if (!host.workspace.openItemSelector) {
12
+ throw new Error('openItemSelector is not available on the current host. Make sure to use an updated version of the host initialization package.');
13
+ }
14
+ return host.workspace.openItemSelector(...args);
15
+ }
16
+ });
17
+ //# sourceMappingURL=itemSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hostModules","require","itemSelector","exports","createHostModule","openItemSelector","host","args","workspace","Error"],"sources":["../../../src/items-selection/itemSelector.ts"],"sourcesContent":["import { createHostModule } from '@wix/sdk-runtime/host-modules';\nimport { WorkspaceHost, ItemSelectorSDK } from '../types';\n\nexport const itemSelector = createHostModule<WorkspaceHost, ItemSelectorSDK>({\n openItemSelector:\n (host) =>\n (...args) => {\n if (!host.workspace) {\n throw new Error(\n 'workspace is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n if (!host.workspace.openItemSelector) {\n throw new Error(\n 'openItemSelector is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n return host.workspace.openItemSelector(...args);\n },\n});\n"],"mappings":";;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,6BAAgB,EAAiC;EAC3EC,gBAAgB,EACbC,IAAI,IACL,CAAC,GAAGC,IAAI,KAAK;IACX,IAAI,CAACD,IAAI,CAACE,SAAS,EAAE;MACnB,MAAM,IAAIC,KAAK,CACb,yHACF,CAAC;IACH;IAEA,IAAI,CAACH,IAAI,CAACE,SAAS,CAACH,gBAAgB,EAAE;MACpC,MAAM,IAAII,KAAK,CACb,gIACF,CAAC;IACH;IAEA,OAAOH,IAAI,CAACE,SAAS,CAACH,gBAAgB,CAAC,GAAGE,IAAI,CAAC;EACjD;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/items-selection/types.ts"],"sourcesContent":["export interface Item {\n /**\n * Item ID\n */\n id: string;\n\n /**\n * Item name.\n */\n name?: string | null;\n\n /**\n * Item description.\n */\n description?: string | null;\n\n /**\n * Item image.\n */\n image?: { url?: string | null };\n\n /**\n * Additional information about the item. For example, an item's price.\n */\n note?: string | null;\n\n /**\n * Additional fields associated with an item. The content of this object might changes based on the Wix service defined in the `tag` field.\n */\n additionalFields?: Record<string, any> | null;\n}\n\nexport interface ItemSelectionOptions {\n /**\n * The provider key, which is typically a combination of the appId and the key set in the dev-center config `appId_key`\n */\n providerKey: string;\n\n /**\n * The maximum number of items that can be selected in the modal. Default is 1 when not set.\n */\n maxSelected?: number;\n\n /**\n * An optional custom text for the primary action button in the modal, providing the ability to override the default content defined by the provider.\n */\n primaryButtonText?: string;\n\n /**\n * An optional custom title for the modal, allowing the override of the default content provided by the provider.\n */\n title?: string;\n\n /**\n * Initial selection items IDs. The items will be selected when the modal is opened.\n */\n initialSelect?: string[];\n}\n\nexport interface ItemSelectionResult {\n items: Item[];\n}\n\nexport type ItemSelection = (\n providerKey: ItemSelectionOptions['providerKey'],\n request?: Omit<ItemSelectionOptions, 'providerKey'>,\n) => Promise<ItemSelectionResult>;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.legacy = void 0;
5
+ var _hostModules = require("@wix/sdk-runtime/host-modules");
6
+ const legacy = exports.legacy = (0, _hostModules.createHostModule)({
7
+ getContextIds: host => () => {
8
+ if (!host.workspace) {
9
+ throw new Error('workspace is not available on the current host. Make sure to use an updated version of the host initialization package.');
10
+ }
11
+ if (!host.workspace.getContextIds) {
12
+ throw new Error('getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.');
13
+ }
14
+ const getContextIds = host.workspace.getContextIds();
15
+ if (!getContextIds) {
16
+ throw new Error('getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.');
17
+ }
18
+ return getContextIds;
19
+ }
20
+ });
21
+ //# sourceMappingURL=legacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hostModules","require","legacy","exports","createHostModule","getContextIds","host","workspace","Error"],"sources":["../../src/legacy.ts"],"sourcesContent":["import { createHostModule } from '@wix/sdk-runtime/host-modules';\nimport { WorkspaceHost, InternalSDK } from './types.js';\n\nexport const legacy = createHostModule<WorkspaceHost, InternalSDK>({\n getContextIds: (host) => () => {\n if (!host.workspace) {\n throw new Error(\n 'workspace is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n if (!host.workspace.getContextIds) {\n throw new Error(\n 'getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n const getContextIds = host.workspace.getContextIds();\n\n if (!getContextIds) {\n throw new Error(\n 'getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n return getContextIds;\n },\n});\n"],"mappings":";;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGO,MAAMC,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,IAAAE,6BAAgB,EAA6B;EACjEC,aAAa,EAAGC,IAAI,IAAK,MAAM;IAC7B,IAAI,CAACA,IAAI,CAACC,SAAS,EAAE;MACnB,MAAM,IAAIC,KAAK,CACb,yHACF,CAAC;IACH;IAEA,IAAI,CAACF,IAAI,CAACC,SAAS,CAACF,aAAa,EAAE;MACjC,MAAM,IAAIG,KAAK,CACb,6HACF,CAAC;IACH;IAEA,MAAMH,aAAa,GAAGC,IAAI,CAACC,SAAS,CAACF,aAAa,CAAC,CAAC;IAEpD,IAAI,CAACA,aAAa,EAAE;MAClB,MAAM,IAAIG,KAAK,CACb,6HACF,CAAC;IACH;IAEA,OAAOH,aAAa;EACtB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/jest-yoshi-preset/types" />
2
+ //# sourceMappingURL=test-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/test-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/jest-yoshi-preset/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type { Host } from '@wix/sdk-types';\n\ntype ContextIds = {\n accountId: string;\n userId: string;\n siteId?: string;\n appId?: string;\n};\n\nexport type WorkspaceHost = Host & {\n workspace?: {\n getContextIds?: () => ContextIds;\n openItemSelector?: (...args: any[]) => any;\n };\n};\n\nexport type InternalSDK = {\n getContextIds?: () => ContextIds;\n};\n\nexport type ItemSelectorSDK = {\n openItemSelector?: (...args: any[]) => any;\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/yoshi-flow-library/types" />
2
+ //# sourceMappingURL=external-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/external-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/yoshi-flow-library/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import { legacy as _legacy } from './legacy.js';
2
+ import { itemSelector as _itemSelector } from './items-selection/itemSelector.js';
3
+ export const itemSelector = _itemSelector;
4
+ export const legacy = _legacy;
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["legacy","_legacy","itemSelector","_itemSelector"],"sources":["../../src/index.ts"],"sourcesContent":["import { legacy as _legacy } from './legacy.js';\nimport { itemSelector as _itemSelector } from './items-selection/itemSelector.js';\nimport type { ExposeFieldsBasedOnToggle } from '@wix/sdk-types';\n\nexport const itemSelector = _itemSelector;\n\nexport const legacy: ExposeFieldsBasedOnToggle<\n typeof _legacy,\n { getContextIds: 'alpha' }\n> = _legacy;\n\nexport type { WorkspaceHost } from './types.js';\n\nexport type {\n ItemSelection,\n ItemSelectionOptions,\n ItemSelectionResult,\n Item,\n} from './items-selection/types.js';\n"],"mappings":"AAAA,SAASA,MAAM,IAAIC,OAAO,QAAQ,aAAa;AAC/C,SAASC,YAAY,IAAIC,aAAa,QAAQ,mCAAmC;AAGjF,OAAO,MAAMD,YAAY,GAAGC,aAAa;AAEzC,OAAO,MAAMH,MAGZ,GAAGC,OAAO","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import { createHostModule } from '@wix/sdk-runtime/host-modules';
2
+ export const itemSelector = createHostModule({
3
+ openItemSelector: host => function () {
4
+ if (!host.workspace) {
5
+ throw new Error('workspace is not available on the current host. Make sure to use an updated version of the host initialization package.');
6
+ }
7
+ if (!host.workspace.openItemSelector) {
8
+ throw new Error('openItemSelector is not available on the current host. Make sure to use an updated version of the host initialization package.');
9
+ }
10
+ return host.workspace.openItemSelector(...arguments);
11
+ }
12
+ });
13
+ //# sourceMappingURL=itemSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createHostModule","itemSelector","openItemSelector","host","workspace","Error","arguments"],"sources":["../../../src/items-selection/itemSelector.ts"],"sourcesContent":["import { createHostModule } from '@wix/sdk-runtime/host-modules';\nimport { WorkspaceHost, ItemSelectorSDK } from '../types';\n\nexport const itemSelector = createHostModule<WorkspaceHost, ItemSelectorSDK>({\n openItemSelector:\n (host) =>\n (...args) => {\n if (!host.workspace) {\n throw new Error(\n 'workspace is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n if (!host.workspace.openItemSelector) {\n throw new Error(\n 'openItemSelector is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n return host.workspace.openItemSelector(...args);\n },\n});\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,+BAA+B;AAGhE,OAAO,MAAMC,YAAY,GAAGD,gBAAgB,CAAiC;EAC3EE,gBAAgB,EACbC,IAAI,IACL,YAAa;IACX,IAAI,CAACA,IAAI,CAACC,SAAS,EAAE;MACnB,MAAM,IAAIC,KAAK,CACb,yHACF,CAAC;IACH;IAEA,IAAI,CAACF,IAAI,CAACC,SAAS,CAACF,gBAAgB,EAAE;MACpC,MAAM,IAAIG,KAAK,CACb,gIACF,CAAC;IACH;IAEA,OAAOF,IAAI,CAACC,SAAS,CAACF,gBAAgB,CAAC,GAAAI,SAAO,CAAC;EACjD;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/items-selection/types.ts"],"sourcesContent":["export interface Item {\n /**\n * Item ID\n */\n id: string;\n\n /**\n * Item name.\n */\n name?: string | null;\n\n /**\n * Item description.\n */\n description?: string | null;\n\n /**\n * Item image.\n */\n image?: { url?: string | null };\n\n /**\n * Additional information about the item. For example, an item's price.\n */\n note?: string | null;\n\n /**\n * Additional fields associated with an item. The content of this object might changes based on the Wix service defined in the `tag` field.\n */\n additionalFields?: Record<string, any> | null;\n}\n\nexport interface ItemSelectionOptions {\n /**\n * The provider key, which is typically a combination of the appId and the key set in the dev-center config `appId_key`\n */\n providerKey: string;\n\n /**\n * The maximum number of items that can be selected in the modal. Default is 1 when not set.\n */\n maxSelected?: number;\n\n /**\n * An optional custom text for the primary action button in the modal, providing the ability to override the default content defined by the provider.\n */\n primaryButtonText?: string;\n\n /**\n * An optional custom title for the modal, allowing the override of the default content provided by the provider.\n */\n title?: string;\n\n /**\n * Initial selection items IDs. The items will be selected when the modal is opened.\n */\n initialSelect?: string[];\n}\n\nexport interface ItemSelectionResult {\n items: Item[];\n}\n\nexport type ItemSelection = (\n providerKey: ItemSelectionOptions['providerKey'],\n request?: Omit<ItemSelectionOptions, 'providerKey'>,\n) => Promise<ItemSelectionResult>;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import { createHostModule } from '@wix/sdk-runtime/host-modules';
2
+ export const legacy = createHostModule({
3
+ getContextIds: host => () => {
4
+ if (!host.workspace) {
5
+ throw new Error('workspace is not available on the current host. Make sure to use an updated version of the host initialization package.');
6
+ }
7
+ if (!host.workspace.getContextIds) {
8
+ throw new Error('getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.');
9
+ }
10
+ const getContextIds = host.workspace.getContextIds();
11
+ if (!getContextIds) {
12
+ throw new Error('getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.');
13
+ }
14
+ return getContextIds;
15
+ }
16
+ });
17
+ //# sourceMappingURL=legacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createHostModule","legacy","getContextIds","host","workspace","Error"],"sources":["../../src/legacy.ts"],"sourcesContent":["import { createHostModule } from '@wix/sdk-runtime/host-modules';\nimport { WorkspaceHost, InternalSDK } from './types.js';\n\nexport const legacy = createHostModule<WorkspaceHost, InternalSDK>({\n getContextIds: (host) => () => {\n if (!host.workspace) {\n throw new Error(\n 'workspace is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n if (!host.workspace.getContextIds) {\n throw new Error(\n 'getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n const getContextIds = host.workspace.getContextIds();\n\n if (!getContextIds) {\n throw new Error(\n 'getContextIds is not available on the current host. Make sure to use an updated version of the host initialization package.',\n );\n }\n\n return getContextIds;\n },\n});\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,+BAA+B;AAGhE,OAAO,MAAMC,MAAM,GAAGD,gBAAgB,CAA6B;EACjEE,aAAa,EAAGC,IAAI,IAAK,MAAM;IAC7B,IAAI,CAACA,IAAI,CAACC,SAAS,EAAE;MACnB,MAAM,IAAIC,KAAK,CACb,yHACF,CAAC;IACH;IAEA,IAAI,CAACF,IAAI,CAACC,SAAS,CAACF,aAAa,EAAE;MACjC,MAAM,IAAIG,KAAK,CACb,6HACF,CAAC;IACH;IAEA,MAAMH,aAAa,GAAGC,IAAI,CAACC,SAAS,CAACF,aAAa,CAAC,CAAC;IAEpD,IAAI,CAACA,aAAa,EAAE;MAClB,MAAM,IAAIG,KAAK,CACb,6HACF,CAAC;IACH;IAEA,OAAOH,aAAa;EACtB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/jest-yoshi-preset/types" />
2
+ //# sourceMappingURL=test-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/test-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/jest-yoshi-preset/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type { Host } from '@wix/sdk-types';\n\ntype ContextIds = {\n accountId: string;\n userId: string;\n siteId?: string;\n appId?: string;\n};\n\nexport type WorkspaceHost = Host & {\n workspace?: {\n getContextIds?: () => ContextIds;\n openItemSelector?: (...args: any[]) => any;\n };\n};\n\nexport type InternalSDK = {\n getContextIds?: () => ContextIds;\n};\n\nexport type ItemSelectorSDK = {\n openItemSelector?: (...args: any[]) => any;\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import { legacy as _legacy } from './legacy.js';
2
+ import type { ExposeFieldsBasedOnToggle } from '@wix/sdk-types';
3
+ export declare const itemSelector: import("./types.js").ItemSelectorSDK & import("@wix/sdk-types").HostModule<import("./types.js").ItemSelectorSDK, import("./types.js").WorkspaceHost>;
4
+ export declare const legacy: ExposeFieldsBasedOnToggle<typeof _legacy, {
5
+ getContextIds: 'alpha';
6
+ }>;
7
+ export type { WorkspaceHost } from './types.js';
8
+ export type { ItemSelection, ItemSelectionOptions, ItemSelectionResult, Item, } from './items-selection/types.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,eAAO,MAAM,YAAY,sJAAgB,CAAC;AAE1C,eAAO,MAAM,MAAM,EAAE,yBAAyB,CAC5C,OAAO,OAAO,EACd;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CACjB,CAAC;AAEZ,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,IAAI,GACL,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { WorkspaceHost, ItemSelectorSDK } from '../types';
2
+ export declare const itemSelector: ItemSelectorSDK & import("@wix/sdk-types").HostModule<ItemSelectorSDK, WorkspaceHost>;
3
+ //# sourceMappingURL=itemSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemSelector.d.ts","sourceRoot":"","sources":["../../../src/items-selection/itemSelector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE1D,eAAO,MAAM,YAAY,uFAkBvB,CAAC"}
@@ -0,0 +1,55 @@
1
+ export interface Item {
2
+ /**
3
+ * Item ID
4
+ */
5
+ id: string;
6
+ /**
7
+ * Item name.
8
+ */
9
+ name?: string | null;
10
+ /**
11
+ * Item description.
12
+ */
13
+ description?: string | null;
14
+ /**
15
+ * Item image.
16
+ */
17
+ image?: {
18
+ url?: string | null;
19
+ };
20
+ /**
21
+ * Additional information about the item. For example, an item's price.
22
+ */
23
+ note?: string | null;
24
+ /**
25
+ * Additional fields associated with an item. The content of this object might changes based on the Wix service defined in the `tag` field.
26
+ */
27
+ additionalFields?: Record<string, any> | null;
28
+ }
29
+ export interface ItemSelectionOptions {
30
+ /**
31
+ * The provider key, which is typically a combination of the appId and the key set in the dev-center config `appId_key`
32
+ */
33
+ providerKey: string;
34
+ /**
35
+ * The maximum number of items that can be selected in the modal. Default is 1 when not set.
36
+ */
37
+ maxSelected?: number;
38
+ /**
39
+ * An optional custom text for the primary action button in the modal, providing the ability to override the default content defined by the provider.
40
+ */
41
+ primaryButtonText?: string;
42
+ /**
43
+ * An optional custom title for the modal, allowing the override of the default content provided by the provider.
44
+ */
45
+ title?: string;
46
+ /**
47
+ * Initial selection items IDs. The items will be selected when the modal is opened.
48
+ */
49
+ initialSelect?: string[];
50
+ }
51
+ export interface ItemSelectionResult {
52
+ items: Item[];
53
+ }
54
+ export declare type ItemSelection = (providerKey: ItemSelectionOptions['providerKey'], request?: Omit<ItemSelectionOptions, 'providerKey'>) => Promise<ItemSelectionResult>;
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/items-selection/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAEhC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAC/C;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,oBAAY,aAAa,GAAG,CAC1B,WAAW,EAAE,oBAAoB,CAAC,aAAa,CAAC,EAChD,OAAO,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,KAChD,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { WorkspaceHost, InternalSDK } from './types.js';
2
+ export declare const legacy: InternalSDK & import("@wix/sdk-types").HostModule<InternalSDK, WorkspaceHost>;
3
+ //# sourceMappingURL=legacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy.d.ts","sourceRoot":"","sources":["../../src/legacy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExD,eAAO,MAAM,MAAM,+EAwBjB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { Host } from '@wix/sdk-types';
2
+ declare type ContextIds = {
3
+ accountId: string;
4
+ userId: string;
5
+ siteId?: string;
6
+ appId?: string;
7
+ };
8
+ export declare type WorkspaceHost = Host & {
9
+ workspace?: {
10
+ getContextIds?: () => ContextIds;
11
+ openItemSelector?: (...args: any[]) => any;
12
+ };
13
+ };
14
+ export declare type InternalSDK = {
15
+ getContextIds?: () => ContextIds;
16
+ };
17
+ export declare type ItemSelectorSDK = {
18
+ openItemSelector?: (...args: any[]) => any;
19
+ };
20
+ export {};
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,aAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,aAAa,GAAG,IAAI,GAAG;IACjC,SAAS,CAAC,EAAE;QACV,aAAa,CAAC,EAAE,MAAM,UAAU,CAAC;QACjC,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;KAC5C,CAAC;CACH,CAAC;AAEF,oBAAY,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,MAAM,UAAU,CAAC;CAClC,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;CAC5C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@wix/workspace",
3
+ "version": "1.0.0",
4
+ "license": "UNLICENSED",
5
+ "author": {
6
+ "name": "Aviv Maimon",
7
+ "email": "avivm@wix.com"
8
+ },
9
+ "main": "dist/cjs/index.js",
10
+ "module": "dist/esm/index.js",
11
+ "sideEffects": false,
12
+ "types": "dist/types/index.d.ts",
13
+ "files": [
14
+ "dist/cjs",
15
+ "dist/esm",
16
+ "dist/types"
17
+ ],
18
+ "scripts": {
19
+ "build": "yoshi-library build",
20
+ "start": "yoshi-library start",
21
+ "test": "vitest run",
22
+ "lint": "yoshi-library lint"
23
+ },
24
+ "publishConfig": {
25
+ "registry": "https://registry.npmjs.org/",
26
+ "access": "public"
27
+ },
28
+ "lint-staged": {
29
+ "*.{js,ts}": "yarn lint"
30
+ },
31
+ "dependencies": {
32
+ "@babel/runtime": "^7.0.0",
33
+ "@wix/sdk": "^1.15.24",
34
+ "@wix/sdk-runtime": "^0.3.57"
35
+ },
36
+ "devDependencies": {
37
+ "@types/jest": "^27.4.0",
38
+ "@types/node": "^16.0.0",
39
+ "@wix/eslint-config-yoshi": "^6.0.0",
40
+ "@wix/jest-yoshi-preset": "^6.0.0",
41
+ "@wix/yoshi-flow-library": "^6.0.0",
42
+ "ts-jest": "^27.1.2",
43
+ "typescript": "~4.7.0",
44
+ "vitest": "^3.2.4"
45
+ },
46
+ "jest": {
47
+ "preset": "@wix/jest-yoshi-preset"
48
+ },
49
+ "yoshiFlowLibrary": {
50
+ "buildEsmWithBabel": true
51
+ },
52
+ "eslintConfig": {
53
+ "extends": "@wix/eslint-config-yoshi"
54
+ },
55
+ "wix": {
56
+ "artifact": {
57
+ "groupId": "com.wixpress",
58
+ "artifactId": "workspace-sdk"
59
+ },
60
+ "validations": {
61
+ "postDependenciesBuild": [
62
+ "lint"
63
+ ]
64
+ },
65
+ "framework": {
66
+ "type": "yoshi-flow-library"
67
+ }
68
+ },
69
+ "wallaby": {
70
+ "autoDetect": true
71
+ },
72
+ "falconPackageHash": "e1603b25ed4b05c1a996d834d1c76c712504a1e0c651fb296764269e"
73
+ }