@wix/site-service-lightbox 0.0.0-stage → 1.0.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.
Files changed (48) hide show
  1. package/README.md +75 -2
  2. package/cjs/build/definition/index.d.ts +23 -0
  3. package/cjs/build/definition/index.js +6 -0
  4. package/cjs/build/definition/index.js.map +1 -0
  5. package/cjs/build/implementations/index.d.ts +1 -0
  6. package/cjs/build/implementations/index.js +6 -0
  7. package/cjs/build/implementations/index.js.map +1 -0
  8. package/cjs/build/implementations/lightboxService.d.ts +6 -0
  9. package/cjs/build/implementations/lightboxService.js +15 -0
  10. package/cjs/build/implementations/lightboxService.js.map +1 -0
  11. package/cjs/build/index.d.ts +2 -0
  12. package/cjs/build/index.js +19 -0
  13. package/cjs/build/index.js.map +1 -0
  14. package/cjs/build/service.d.ts +7 -0
  15. package/cjs/build/service.js +8 -0
  16. package/cjs/build/service.js.map +1 -0
  17. package/cjs/build/types/index.d.ts +1 -0
  18. package/cjs/build/types/index.js +3 -0
  19. package/cjs/build/types/index.js.map +1 -0
  20. package/cjs/package.json +3 -0
  21. package/definition/package.json +3 -0
  22. package/dist/definition/index.d.ts +23 -0
  23. package/dist/definition/index.js +3 -0
  24. package/dist/definition/index.js.map +1 -0
  25. package/dist/implementations/index.d.ts +1 -0
  26. package/dist/implementations/index.js +2 -0
  27. package/dist/implementations/index.js.map +1 -0
  28. package/dist/implementations/lightboxService.d.ts +6 -0
  29. package/dist/implementations/lightboxService.js +12 -0
  30. package/dist/implementations/lightboxService.js.map +1 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.js +3 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/service.d.ts +7 -0
  35. package/dist/service.js +5 -0
  36. package/dist/service.js.map +1 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/index.js +2 -0
  39. package/dist/types/index.js.map +1 -0
  40. package/implementations/package.json +3 -0
  41. package/package.json +78 -3
  42. package/src/definition/index.ts +26 -0
  43. package/src/implementations/index.ts +1 -0
  44. package/src/implementations/lightboxService.ts +17 -0
  45. package/src/index.ts +2 -0
  46. package/src/service.ts +5 -0
  47. package/src/types/index.ts +7 -0
  48. package/types/package.json +3 -0
package/README.md CHANGED
@@ -1,3 +1,76 @@
1
- # Temporary Holding Version
1
+ # @wix/site-service-lightbox
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Opens and closes **lightboxes** (popups) and reads the context the open lightbox was
4
+ opened with. Only one lightbox is open at a time. UI & Viewport category.
5
+
6
+ ## Install
7
+
8
+ ```sh
9
+ yarn add @wix/site-service-lightbox
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```ts
15
+ import { LightboxDefinition } from '@wix/site-service-lightbox/definition'
16
+
17
+ const lightbox = useService(LightboxDefinition)
18
+
19
+ type SignupContext = { source: string }
20
+
21
+ // Open a lightbox page, passing it some context:
22
+ await lightbox.open<SignupContext>({ pageId: 'lightbox-page-id', context: { source: 'signup' } })
23
+
24
+ // In a component rendered inside the lightbox:
25
+ const context = lightbox.getContext<SignupContext>()
26
+ lightbox.close()
27
+ ```
28
+
29
+ The host (Thunderbolt) registers the service and injects the actual behavior:
30
+
31
+ ```ts
32
+ import { LightboxDefinition } from '@wix/site-service-lightbox/definition'
33
+ import { LightboxService } from '@wix/site-service-lightbox/implementations'
34
+
35
+ createServicesMap().addService(LightboxDefinition, LightboxService, {
36
+ open: async ({ pageId, context }) => {
37
+ /* open the lightbox page */
38
+ },
39
+ close: () => {
40
+ /* close the open lightbox */
41
+ },
42
+ getContext: () => {
43
+ /* return the open lightbox's context */
44
+ },
45
+ })
46
+ ```
47
+
48
+ ## API
49
+
50
+ | Member | Type | Description |
51
+ |---|---|---|
52
+ | `open` | `<TContext = LightboxContext>(options: { pageId: string; context?: TContext }) => Promise<void>` | Opens the lightbox page `pageId` with `context`. Returns the host's promise. |
53
+ | `close` | `() => void` | Closes the currently open lightbox. Fire-and-forget: returns nothing, even if the host's close is async. |
54
+ | `getContext` | `<TContext = LightboxContext>() => TContext` | Returns the context the open lightbox was opened with. |
55
+
56
+ All three are plain methods — this service exposes no property getters.
57
+
58
+ The context is opaque to the service: it passes the value through unchanged and never reads it
59
+ (`LightboxContext` is `unknown`).
60
+ `TContext` types it for the caller, but nothing checks that `getContext<TContext>()` asks for
61
+ the same type the lightbox was opened with; that is the caller's assertion.
62
+
63
+ ## Configuration
64
+
65
+ `ILightboxServiceConfig`:
66
+
67
+ ```ts
68
+ export type ILightboxServiceConfig = {
69
+ open: (options: LightboxOpenOptions) => Promise<void>
70
+ close: () => void
71
+ getContext: () => LightboxContext
72
+ }
73
+ ```
74
+
75
+ - `open`, `close`, `getContext` — the host's implementations. The service calls them on each use.
76
+ All three are required; the service has no fallback behavior.
@@ -0,0 +1,23 @@
1
+ import type { ServiceDefinition } from '@wix/services-definitions';
2
+ export type LightboxContext = unknown;
3
+ export type LightboxOpenOptions<TContext = LightboxContext> = {
4
+ pageId: string;
5
+ context?: TContext;
6
+ };
7
+ export type ILightboxServiceConfig = {
8
+ open: (options: LightboxOpenOptions) => Promise<void>;
9
+ close: () => void;
10
+ getContext: () => LightboxContext;
11
+ };
12
+ export interface ILightboxService {
13
+ open<TContext = LightboxContext>(options: LightboxOpenOptions<TContext>): Promise<void>;
14
+ close(): void;
15
+ /** Not checked against the context passed to `open`; the caller asserts its type. */
16
+ getContext<TContext = LightboxContext>(): TContext;
17
+ }
18
+ export type ILightboxDefinition = ServiceDefinition<ILightboxService, ILightboxServiceConfig>;
19
+ export declare const LightboxDefinition: string & {
20
+ __api: ILightboxService;
21
+ __config: ILightboxServiceConfig;
22
+ isServiceDefinition?: boolean;
23
+ } & ILightboxService;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LightboxDefinition = void 0;
4
+ const services_definitions_1 = require("@wix/services-definitions");
5
+ exports.LightboxDefinition = (0, services_definitions_1.defineService)('@wix/site-service-lightbox');
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAyB5C,QAAA,kBAAkB,GAAG,IAAA,oCAAa,EAA2C,4BAA4B,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export { LightboxService } from './lightboxService';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LightboxService = void 0;
4
+ var lightboxService_1 = require("./lightboxService");
5
+ Object.defineProperty(exports, "LightboxService", { enumerable: true, get: function () { return lightboxService_1.LightboxService; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/implementations/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,kHAAA,eAAe,OAAA"}
@@ -0,0 +1,6 @@
1
+ import type { ILightboxService, ILightboxServiceConfig } from '../definition';
2
+ export declare const LightboxService: import("@wix/services-definitions").ServiceFactory<string & {
3
+ __api: ILightboxService;
4
+ __config: ILightboxServiceConfig;
5
+ isServiceDefinition?: boolean;
6
+ } & ILightboxService, ILightboxServiceConfig>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LightboxService = void 0;
4
+ const services_definitions_1 = require("@wix/services-definitions");
5
+ const definition_1 = require("../definition");
6
+ exports.LightboxService = (0, services_definitions_1.implementService)(definition_1.LightboxDefinition, ({ config }) => {
7
+ return {
8
+ open: (options) => config.open(options),
9
+ close: () => {
10
+ config.close();
11
+ },
12
+ getContext: () => config.getContext(),
13
+ };
14
+ });
15
+ //# sourceMappingURL=lightboxService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lightboxService.js","sourceRoot":"","sources":["../../../src/implementations/lightboxService.ts"],"names":[],"mappings":";;;AAAA,oEAA4D;AAG5D,8CAAkD;AAErC,QAAA,eAAe,GAAG,IAAA,uCAAgB,EAC9C,+BAAkB,EAClB,CAAC,EAAE,MAAM,EAA8C,EAAoB,EAAE;IAC5E,OAAO;QACN,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QACvC,KAAK,EAAE,GAAG,EAAE;YACX,MAAM,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;QACD,UAAU,EAAE,GAAa,EAAE,CAAC,MAAM,CAAC,UAAU,EAAc;KAC3D,CAAA;AACF,CAAC,CACD,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './definition';
2
+ export * from './implementations';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./definition"), exports);
18
+ __exportStar(require("./implementations"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,oDAAiC"}
@@ -0,0 +1,7 @@
1
+ import { LightboxService } from './implementations/lightboxService';
2
+ export declare const definition: string & {
3
+ __api: import("./definition").ILightboxService;
4
+ __config: import("./definition").ILightboxServiceConfig;
5
+ isServiceDefinition?: boolean;
6
+ } & import("./definition").ILightboxService;
7
+ export default LightboxService;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.definition = void 0;
4
+ const definition_1 = require("./definition");
5
+ const lightboxService_1 = require("./implementations/lightboxService");
6
+ exports.definition = definition_1.LightboxDefinition;
7
+ exports.default = lightboxService_1.LightboxService;
8
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/service.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AACjD,uEAAmE;AAEtD,QAAA,UAAU,GAAG,+BAAkB,CAAA;kBAC7B,iCAAe"}
@@ -0,0 +1 @@
1
+ export type { ILightboxService, ILightboxServiceConfig, ILightboxDefinition, LightboxContext, LightboxOpenOptions, } from '../definition';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "../cjs/build/definition/index.js"
3
+ }
@@ -0,0 +1,23 @@
1
+ import type { ServiceDefinition } from '@wix/services-definitions';
2
+ export type LightboxContext = unknown;
3
+ export type LightboxOpenOptions<TContext = LightboxContext> = {
4
+ pageId: string;
5
+ context?: TContext;
6
+ };
7
+ export type ILightboxServiceConfig = {
8
+ open: (options: LightboxOpenOptions) => Promise<void>;
9
+ close: () => void;
10
+ getContext: () => LightboxContext;
11
+ };
12
+ export interface ILightboxService {
13
+ open<TContext = LightboxContext>(options: LightboxOpenOptions<TContext>): Promise<void>;
14
+ close(): void;
15
+ /** Not checked against the context passed to `open`; the caller asserts its type. */
16
+ getContext<TContext = LightboxContext>(): TContext;
17
+ }
18
+ export type ILightboxDefinition = ServiceDefinition<ILightboxService, ILightboxServiceConfig>;
19
+ export declare const LightboxDefinition: string & {
20
+ __api: ILightboxService;
21
+ __config: ILightboxServiceConfig;
22
+ isServiceDefinition?: boolean;
23
+ } & ILightboxService;
@@ -0,0 +1,3 @@
1
+ import { defineService } from '@wix/services-definitions';
2
+ export const LightboxDefinition = defineService('@wix/site-service-lightbox');
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAyBzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAA2C,4BAA4B,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export { LightboxService } from './lightboxService';
@@ -0,0 +1,2 @@
1
+ export { LightboxService } from './lightboxService';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/implementations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { ILightboxService, ILightboxServiceConfig } from '../definition';
2
+ export declare const LightboxService: import("@wix/services-definitions").ServiceFactory<string & {
3
+ __api: ILightboxService;
4
+ __config: ILightboxServiceConfig;
5
+ isServiceDefinition?: boolean;
6
+ } & ILightboxService, ILightboxServiceConfig>;
@@ -0,0 +1,12 @@
1
+ import { implementService } from '@wix/services-definitions';
2
+ import { LightboxDefinition } from '../definition';
3
+ export const LightboxService = implementService(LightboxDefinition, ({ config }) => {
4
+ return {
5
+ open: (options) => config.open(options),
6
+ close: () => {
7
+ config.close();
8
+ },
9
+ getContext: () => config.getContext(),
10
+ };
11
+ });
12
+ //# sourceMappingURL=lightboxService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lightboxService.js","sourceRoot":"","sources":["../../src/implementations/lightboxService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAC9C,kBAAkB,EAClB,CAAC,EAAE,MAAM,EAA8C,EAAoB,EAAE;IAC5E,OAAO;QACN,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QACvC,KAAK,EAAE,GAAG,EAAE;YACX,MAAM,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;QACD,UAAU,EAAE,GAAa,EAAE,CAAC,MAAM,CAAC,UAAU,EAAc;KAC3D,CAAA;AACF,CAAC,CACD,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './definition';
2
+ export * from './implementations';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './definition';
2
+ export * from './implementations';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { LightboxService } from './implementations/lightboxService';
2
+ export declare const definition: string & {
3
+ __api: import("./definition").ILightboxService;
4
+ __config: import("./definition").ILightboxServiceConfig;
5
+ isServiceDefinition?: boolean;
6
+ } & import("./definition").ILightboxService;
7
+ export default LightboxService;
@@ -0,0 +1,5 @@
1
+ import { LightboxDefinition } from './definition';
2
+ import { LightboxService } from './implementations/lightboxService';
3
+ export const definition = LightboxDefinition;
4
+ export default LightboxService;
5
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AAEnE,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAA;AAC5C,eAAe,eAAe,CAAA"}
@@ -0,0 +1 @@
1
+ export type { ILightboxService, ILightboxServiceConfig, ILightboxDefinition, LightboxContext, LightboxOpenOptions, } from '../definition';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "../cjs/build/implementations/index.js"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,81 @@
1
1
  {
2
2
  "name": "@wix/site-service-lightbox",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.1",
4
+ "license": "UNLICENSED",
5
+ "files": [
6
+ "dist",
7
+ "src",
8
+ "cjs",
9
+ "definition",
10
+ "implementations",
11
+ "types",
12
+ "!**/*.tsbuildinfo"
13
+ ],
14
+ "sideEffects": false,
15
+ "main": "cjs/build/index.js",
16
+ "module": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "require": "./cjs/build/index.js"
23
+ },
24
+ "./definition": {
25
+ "types": "./dist/definition/index.d.ts",
26
+ "import": "./dist/definition/index.js",
27
+ "require": "./cjs/build/definition/index.js"
28
+ },
29
+ "./implementations": {
30
+ "types": "./dist/implementations/index.d.ts",
31
+ "import": "./dist/implementations/index.js",
32
+ "require": "./cjs/build/implementations/index.js"
33
+ },
34
+ "./types": {
35
+ "types": "./dist/types/index.d.ts",
36
+ "import": "./dist/types/index.js",
37
+ "require": "./cjs/build/types/index.js"
38
+ },
39
+ "./service": {
40
+ "types": "./dist/service.d.ts",
41
+ "import": "./dist/service.js",
42
+ "require": "./cjs/build/service.js"
43
+ }
44
+ },
45
+ "publishConfig": {
46
+ "registry": "https://registry.npmjs.org/",
47
+ "access": "public"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -b . && tsc --project tsconfig.cjs.json",
51
+ "lint": "yarn run -T lint:package $npm_package_name",
52
+ "test": "vitest --run && yarn test-type-check",
53
+ "test-type-check": "echo 'validating typescript in test files' && tsc --project tsconfig.test.json && echo 'Finished validating typescript in test files successfully'"
54
+ },
55
+ "dependencies": {
56
+ "@wix/services-definitions": "^0.1.4",
57
+ "@wix/services-manager": "^0.2.20"
58
+ },
59
+ "devDependencies": {
60
+ "typescript": "~7.0.2",
61
+ "vitest": "4.1.11"
62
+ },
63
+ "publishUnscoped": false,
64
+ "wix": {
65
+ "artifact": {
66
+ "groupId": "com.wixpress.npm",
67
+ "artifactId": "site-service-lightbox",
68
+ "targets": {
69
+ "static": false,
70
+ "docker": false
71
+ }
72
+ },
73
+ "validations": {
74
+ "postBuild": [
75
+ "test",
76
+ "lint"
77
+ ]
78
+ }
79
+ },
80
+ "falconPackageHash": "1696cfcdbb8f4bb6c4f21b27a5d3030b681f823e711627fdf54565b1"
6
81
  }
@@ -0,0 +1,26 @@
1
+ import { defineService } from '@wix/services-definitions'
2
+ import type { ServiceDefinition } from '@wix/services-definitions'
3
+
4
+ export type LightboxContext = unknown
5
+
6
+ export type LightboxOpenOptions<TContext = LightboxContext> = {
7
+ pageId: string
8
+ context?: TContext
9
+ }
10
+
11
+ export type ILightboxServiceConfig = {
12
+ open: (options: LightboxOpenOptions) => Promise<void>
13
+ close: () => void
14
+ getContext: () => LightboxContext
15
+ }
16
+
17
+ export interface ILightboxService {
18
+ open<TContext = LightboxContext>(options: LightboxOpenOptions<TContext>): Promise<void>
19
+ close(): void
20
+ /** Not checked against the context passed to `open`; the caller asserts its type. */
21
+ getContext<TContext = LightboxContext>(): TContext
22
+ }
23
+
24
+ export type ILightboxDefinition = ServiceDefinition<ILightboxService, ILightboxServiceConfig>
25
+
26
+ export const LightboxDefinition = defineService<ILightboxService, ILightboxServiceConfig>('@wix/site-service-lightbox')
@@ -0,0 +1 @@
1
+ export { LightboxService } from './lightboxService'
@@ -0,0 +1,17 @@
1
+ import { implementService } from '@wix/services-definitions'
2
+ import type { ServiceFactoryOpts } from '@wix/services-definitions'
3
+ import type { ILightboxService, ILightboxServiceConfig } from '../definition'
4
+ import { LightboxDefinition } from '../definition'
5
+
6
+ export const LightboxService = implementService(
7
+ LightboxDefinition,
8
+ ({ config }: ServiceFactoryOpts<ILightboxServiceConfig>): ILightboxService => {
9
+ return {
10
+ open: (options) => config.open(options),
11
+ close: () => {
12
+ config.close()
13
+ },
14
+ getContext: <TContext>() => config.getContext() as TContext,
15
+ }
16
+ }
17
+ )
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './definition'
2
+ export * from './implementations'
package/src/service.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { LightboxDefinition } from './definition'
2
+ import { LightboxService } from './implementations/lightboxService'
3
+
4
+ export const definition = LightboxDefinition
5
+ export default LightboxService
@@ -0,0 +1,7 @@
1
+ export type {
2
+ ILightboxService,
3
+ ILightboxServiceConfig,
4
+ ILightboxDefinition,
5
+ LightboxContext,
6
+ LightboxOpenOptions,
7
+ } from '../definition'
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "../cjs/build/types/index.js"
3
+ }