@wix/site-service-lightbox 2.1.0 → 3.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.
package/README.md CHANGED
@@ -50,18 +50,27 @@ createServicesMap().addService(LightboxDefinition, LightboxService, {
50
50
 
51
51
  | Member | Type | Description |
52
52
  |---|---|---|
53
- | `open` | `<TPayload = LightboxPayload>(options: { slug: string; payload?: TPayload; context?: TPayload } \| { pageId: string; payload?: TPayload; context?: TPayload }) => Promise<void>` | Opens the lightbox with `payload`. Pass `slug` (the lightbox page's `pageUriSEO`), or the deprecated `pageId`, not both. The deprecated `context` option still works and is ignored when `payload` is set. Returns the host's promise. |
53
+ | `open` | `<TPayload = LightboxPayload>(options: { slug: string; payload?: TPayload } \| { pageId: string; payload?: TPayload }) => Promise<void>` | Opens the lightbox with `payload`. Pass `slug` (the lightbox page's `pageUriSEO`), or the deprecated `pageId`, not both. Returns the host's promise. |
54
54
  | `close` | `() => void` | Closes the currently open lightbox. Fire-and-forget: returns nothing, even if the host's close is async. |
55
55
  | `getPayload` | `<TPayload = LightboxPayload>() => TPayload` | Returns the payload the open lightbox was opened with. |
56
- | `getContext` | `<TPayload = LightboxPayload>() => TPayload` | **Deprecated**, use `getPayload`. Same behavior. |
57
56
 
58
- All four are plain methods — this service exposes no property getters.
57
+ All three are plain methods — this service exposes no property getters.
59
58
 
60
59
  The payload is opaque to the service: it passes the value through unchanged and never reads it
61
- (`LightboxPayload` is `unknown`; `LightboxContext` is its deprecated alias).
60
+ (`LightboxPayload` is `unknown`).
62
61
  `TPayload` types it for the caller, but nothing checks that `getPayload<TPayload>()` asks for
63
62
  the same type the lightbox was opened with; that is the caller's assertion.
64
63
 
64
+ ## Migrating from 1.x or 2.x
65
+
66
+ 2.0.0 renamed the value you pass to a lightbox from "context" to "payload", and 2.1.0 kept the old
67
+ names as deprecated aliases. 3.0.0 removes them:
68
+
69
+ - `open({ slug, context })` becomes `open({ slug, payload })`.
70
+ - `getContext()` becomes `getPayload()`.
71
+ - `LightboxContext` becomes `LightboxPayload`, and the `TContext` type parameter becomes `TPayload`.
72
+ - The host config's `getContext` becomes `getPayload`, and `open` reads `options.payload`.
73
+
65
74
  ## Configuration
66
75
 
67
76
  `ILightboxServiceConfig`:
@@ -74,9 +83,7 @@ export type ILightboxServiceConfig = {
74
83
  }
75
84
  ```
76
85
 
77
- - Hosts upgrading from 1.x: `getContext` is renamed `getPayload` (2.0.0), and `open` reads `options.payload`.
78
86
  - `open`, `close`, `getPayload` — the host's implementations. The service calls them on each use.
79
87
  All three are required; the service has no fallback behavior.
80
88
  - `open` receives the options unchanged, with either `slug` or `pageId`, and must handle both. It should
81
- reject when no lightbox has the slug. The value is always in `payload`: the service moves the
82
- deprecated `context` option into `payload` before calling `open`.
89
+ reject when no lightbox has the slug.
@@ -4,10 +4,6 @@ import type { ServiceDefinition } from '@wix/services-definitions';
4
4
  * reading or copying it.
5
5
  */
6
6
  export type LightboxPayload = unknown;
7
- /**
8
- * @deprecated Use `LightboxPayload` instead.
9
- */
10
- export type LightboxContext = LightboxPayload;
11
7
  /**
12
8
  * Options for `open()` that identify the popup by its slug.
13
9
  */
@@ -26,12 +22,6 @@ export type LightboxOpenBySlugOptions<TPayload = LightboxPayload> = {
26
22
  * @exampleValue `{ "productId": "spring-jacket" }`
27
23
  */
28
24
  payload?: TPayload;
29
- /**
30
- * Information to pass to the popup. Ignored when you specify `payload`.
31
- *
32
- * @deprecated Use `payload` instead.
33
- */
34
- context?: TPayload;
35
25
  };
36
26
  /**
37
27
  * Options for `open()` that identify the popup by its page ID.
@@ -57,12 +47,6 @@ export type LightboxOpenByPageIdOptions<TPayload = LightboxPayload> = {
57
47
  * @exampleValue `{ "productId": "spring-jacket" }`
58
48
  */
59
49
  payload?: TPayload;
60
- /**
61
- * Information to pass to the popup. Ignored when you specify `payload`.
62
- *
63
- * @deprecated Use `payload` instead.
64
- */
65
- context?: TPayload;
66
50
  };
67
51
  /**
68
52
  * Options for `open()`, with the popup to open and the value to open it with. Specify the popup by
@@ -73,10 +57,7 @@ export type LightboxOpenOptions<TPayload = LightboxPayload> = LightboxOpenBySlug
73
57
  * Values the host supplies when it creates the service.
74
58
  */
75
59
  export type ILightboxServiceConfig = {
76
- /**
77
- * Opens the popup with the slug or the page ID, and rejects when no popup has that slug. The service
78
- * passes the value in `payload`, never in the deprecated `context`.
79
- */
60
+ /** Opens the popup with the slug or the page ID, and rejects when no popup has that slug. */
80
61
  open: (options: LightboxOpenOptions) => Promise<void>;
81
62
  close: () => void;
82
63
  getPayload: () => LightboxPayload;
@@ -209,12 +190,6 @@ export interface ILightboxService {
209
190
  * ```
210
191
  */
211
192
  getPayload<TPayload = LightboxPayload>(): TPayload;
212
- /**
213
- * Retrieves the payload of the open popup.
214
- *
215
- * @deprecated Use `getPayload()` instead.
216
- */
217
- getContext<TPayload = LightboxPayload>(): TPayload;
218
193
  }
219
194
  export type ILightboxDefinition = ServiceDefinition<ILightboxService, ILightboxServiceConfig>;
220
195
  export declare const LightboxDefinition: string & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAuO5C,QAAA,kBAAkB,GAAG,IAAA,oCAAa,EAA2C,4BAA4B,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AA6M5C,QAAA,kBAAkB,GAAG,IAAA,oCAAa,EAA2C,4BAA4B,CAAC,CAAA"}
@@ -3,20 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LightboxService = void 0;
4
4
  const services_definitions_1 = require("@wix/services-definitions");
5
5
  const definition_1 = require("../definition");
6
- const withPayloadInsteadOfContext = ({ context, ...options }) => {
7
- const isPayloadSpecified = 'payload' in options;
8
- const payload = isPayloadSpecified ? options.payload : context;
9
- return { ...options, payload };
10
- };
11
6
  exports.LightboxService = (0, services_definitions_1.implementService)(definition_1.LightboxDefinition, ({ config }) => {
12
- const getPayload = () => config.getPayload();
13
7
  return {
14
- open: (options) => config.open(withPayloadInsteadOfContext(options)),
8
+ open: (options) => config.open(options),
15
9
  close: () => {
16
10
  config.close();
17
11
  },
18
- getPayload,
19
- getContext: getPayload,
12
+ getPayload: () => config.getPayload(),
20
13
  };
21
14
  });
22
15
  //# sourceMappingURL=lightboxService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lightboxService.js","sourceRoot":"","sources":["../../../src/implementations/lightboxService.ts"],"names":[],"mappings":";;;AAAA,oEAA4D;AAG5D,8CAAkD;AAElD,MAAM,2BAA2B,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAuB,EAAuB,EAAE;IACzG,MAAM,kBAAkB,GAAG,SAAS,IAAI,OAAO,CAAA;IAC/C,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAA;IAC9D,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAA;AAC/B,CAAC,CAAA;AAEY,QAAA,eAAe,GAAG,IAAA,uCAAgB,EAC9C,+BAAkB,EAClB,CAAC,EAAE,MAAM,EAA8C,EAAoB,EAAE;IAC5E,MAAM,UAAU,GAAG,GAAa,EAAE,CAAC,MAAM,CAAC,UAAU,EAAc,CAAA;IAClE,OAAO;QACN,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;QACpE,KAAK,EAAE,GAAG,EAAE;YACX,MAAM,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;QACD,UAAU;QACV,UAAU,EAAE,UAAU;KACtB,CAAA;AACF,CAAC,CACD,CAAA"}
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"}
@@ -1 +1 @@
1
- export type { ILightboxService, ILightboxServiceConfig, ILightboxDefinition, LightboxPayload, LightboxContext, LightboxOpenOptions, LightboxOpenBySlugOptions, LightboxOpenByPageIdOptions, } from '../definition';
1
+ export type { ILightboxService, ILightboxServiceConfig, ILightboxDefinition, LightboxPayload, LightboxOpenOptions, LightboxOpenBySlugOptions, LightboxOpenByPageIdOptions, } from '../definition';
@@ -4,10 +4,6 @@ import type { ServiceDefinition } from '@wix/services-definitions';
4
4
  * reading or copying it.
5
5
  */
6
6
  export type LightboxPayload = unknown;
7
- /**
8
- * @deprecated Use `LightboxPayload` instead.
9
- */
10
- export type LightboxContext = LightboxPayload;
11
7
  /**
12
8
  * Options for `open()` that identify the popup by its slug.
13
9
  */
@@ -26,12 +22,6 @@ export type LightboxOpenBySlugOptions<TPayload = LightboxPayload> = {
26
22
  * @exampleValue `{ "productId": "spring-jacket" }`
27
23
  */
28
24
  payload?: TPayload;
29
- /**
30
- * Information to pass to the popup. Ignored when you specify `payload`.
31
- *
32
- * @deprecated Use `payload` instead.
33
- */
34
- context?: TPayload;
35
25
  };
36
26
  /**
37
27
  * Options for `open()` that identify the popup by its page ID.
@@ -57,12 +47,6 @@ export type LightboxOpenByPageIdOptions<TPayload = LightboxPayload> = {
57
47
  * @exampleValue `{ "productId": "spring-jacket" }`
58
48
  */
59
49
  payload?: TPayload;
60
- /**
61
- * Information to pass to the popup. Ignored when you specify `payload`.
62
- *
63
- * @deprecated Use `payload` instead.
64
- */
65
- context?: TPayload;
66
50
  };
67
51
  /**
68
52
  * Options for `open()`, with the popup to open and the value to open it with. Specify the popup by
@@ -73,10 +57,7 @@ export type LightboxOpenOptions<TPayload = LightboxPayload> = LightboxOpenBySlug
73
57
  * Values the host supplies when it creates the service.
74
58
  */
75
59
  export type ILightboxServiceConfig = {
76
- /**
77
- * Opens the popup with the slug or the page ID, and rejects when no popup has that slug. The service
78
- * passes the value in `payload`, never in the deprecated `context`.
79
- */
60
+ /** Opens the popup with the slug or the page ID, and rejects when no popup has that slug. */
80
61
  open: (options: LightboxOpenOptions) => Promise<void>;
81
62
  close: () => void;
82
63
  getPayload: () => LightboxPayload;
@@ -209,12 +190,6 @@ export interface ILightboxService {
209
190
  * ```
210
191
  */
211
192
  getPayload<TPayload = LightboxPayload>(): TPayload;
212
- /**
213
- * Retrieves the payload of the open popup.
214
- *
215
- * @deprecated Use `getPayload()` instead.
216
- */
217
- getContext<TPayload = LightboxPayload>(): TPayload;
218
193
  }
219
194
  export type ILightboxDefinition = ServiceDefinition<ILightboxService, ILightboxServiceConfig>;
220
195
  export declare const LightboxDefinition: string & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAuOzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAA2C,4BAA4B,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AA6MzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAA2C,4BAA4B,CAAC,CAAA"}
@@ -1,19 +1,12 @@
1
1
  import { implementService } from '@wix/services-definitions';
2
2
  import { LightboxDefinition } from '../definition';
3
- const withPayloadInsteadOfContext = ({ context, ...options }) => {
4
- const isPayloadSpecified = 'payload' in options;
5
- const payload = isPayloadSpecified ? options.payload : context;
6
- return { ...options, payload };
7
- };
8
3
  export const LightboxService = implementService(LightboxDefinition, ({ config }) => {
9
- const getPayload = () => config.getPayload();
10
4
  return {
11
- open: (options) => config.open(withPayloadInsteadOfContext(options)),
5
+ open: (options) => config.open(options),
12
6
  close: () => {
13
7
  config.close();
14
8
  },
15
- getPayload,
16
- getContext: getPayload,
9
+ getPayload: () => config.getPayload(),
17
10
  };
18
11
  });
19
12
  //# sourceMappingURL=lightboxService.js.map
@@ -1 +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,2BAA2B,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAuB,EAAuB,EAAE;IACzG,MAAM,kBAAkB,GAAG,SAAS,IAAI,OAAO,CAAA;IAC/C,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAA;IAC9D,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAC9C,kBAAkB,EAClB,CAAC,EAAE,MAAM,EAA8C,EAAoB,EAAE;IAC5E,MAAM,UAAU,GAAG,GAAa,EAAE,CAAC,MAAM,CAAC,UAAU,EAAc,CAAA;IAClE,OAAO;QACN,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;QACpE,KAAK,EAAE,GAAG,EAAE;YACX,MAAM,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;QACD,UAAU;QACV,UAAU,EAAE,UAAU;KACtB,CAAA;AACF,CAAC,CACD,CAAA"}
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"}
@@ -1 +1 @@
1
- export type { ILightboxService, ILightboxServiceConfig, ILightboxDefinition, LightboxPayload, LightboxContext, LightboxOpenOptions, LightboxOpenBySlugOptions, LightboxOpenByPageIdOptions, } from '../definition';
1
+ export type { ILightboxService, ILightboxServiceConfig, ILightboxDefinition, LightboxPayload, LightboxOpenOptions, LightboxOpenBySlugOptions, LightboxOpenByPageIdOptions, } from '../definition';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/site-service-lightbox",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "dist",
@@ -77,5 +77,5 @@
77
77
  ]
78
78
  }
79
79
  },
80
- "falconPackageHash": "85ae3c49a94471c9119643e7aeb09af9ac4cedca4c52823caac48bec"
80
+ "falconPackageHash": "fbe510bb03264cffaf1a8834789e337eef4c465e2accb766c1c5a67f"
81
81
  }
@@ -7,11 +7,6 @@ import type { ServiceDefinition } from '@wix/services-definitions'
7
7
  */
8
8
  export type LightboxPayload = unknown
9
9
 
10
- /**
11
- * @deprecated Use `LightboxPayload` instead.
12
- */
13
- export type LightboxContext = LightboxPayload
14
-
15
10
  /**
16
11
  * Options for `open()` that identify the popup by its slug.
17
12
  */
@@ -30,12 +25,6 @@ export type LightboxOpenBySlugOptions<TPayload = LightboxPayload> = {
30
25
  * @exampleValue `{ "productId": "spring-jacket" }`
31
26
  */
32
27
  payload?: TPayload
33
- /**
34
- * Information to pass to the popup. Ignored when you specify `payload`.
35
- *
36
- * @deprecated Use `payload` instead.
37
- */
38
- context?: TPayload
39
28
  }
40
29
 
41
30
  /**
@@ -62,12 +51,6 @@ export type LightboxOpenByPageIdOptions<TPayload = LightboxPayload> = {
62
51
  * @exampleValue `{ "productId": "spring-jacket" }`
63
52
  */
64
53
  payload?: TPayload
65
- /**
66
- * Information to pass to the popup. Ignored when you specify `payload`.
67
- *
68
- * @deprecated Use `payload` instead.
69
- */
70
- context?: TPayload
71
54
  }
72
55
 
73
56
  /**
@@ -82,10 +65,7 @@ export type LightboxOpenOptions<TPayload = LightboxPayload> =
82
65
  * Values the host supplies when it creates the service.
83
66
  */
84
67
  export type ILightboxServiceConfig = {
85
- /**
86
- * Opens the popup with the slug or the page ID, and rejects when no popup has that slug. The service
87
- * passes the value in `payload`, never in the deprecated `context`.
88
- */
68
+ /** Opens the popup with the slug or the page ID, and rejects when no popup has that slug. */
89
69
  open: (options: LightboxOpenOptions) => Promise<void>
90
70
  close: () => void
91
71
  getPayload: () => LightboxPayload
@@ -219,12 +199,6 @@ export interface ILightboxService {
219
199
  * ```
220
200
  */
221
201
  getPayload<TPayload = LightboxPayload>(): TPayload
222
- /**
223
- * Retrieves the payload of the open popup.
224
- *
225
- * @deprecated Use `getPayload()` instead.
226
- */
227
- getContext<TPayload = LightboxPayload>(): TPayload
228
202
  }
229
203
 
230
204
  export type ILightboxDefinition = ServiceDefinition<ILightboxService, ILightboxServiceConfig>
@@ -1,25 +1,17 @@
1
1
  import { implementService } from '@wix/services-definitions'
2
2
  import type { ServiceFactoryOpts } from '@wix/services-definitions'
3
- import type { ILightboxService, ILightboxServiceConfig, LightboxOpenOptions } from '../definition'
3
+ import type { ILightboxService, ILightboxServiceConfig } from '../definition'
4
4
  import { LightboxDefinition } from '../definition'
5
5
 
6
- const withPayloadInsteadOfContext = ({ context, ...options }: LightboxOpenOptions): LightboxOpenOptions => {
7
- const isPayloadSpecified = 'payload' in options
8
- const payload = isPayloadSpecified ? options.payload : context
9
- return { ...options, payload }
10
- }
11
-
12
6
  export const LightboxService = implementService(
13
7
  LightboxDefinition,
14
8
  ({ config }: ServiceFactoryOpts<ILightboxServiceConfig>): ILightboxService => {
15
- const getPayload = <TPayload>() => config.getPayload() as TPayload
16
9
  return {
17
- open: (options) => config.open(withPayloadInsteadOfContext(options)),
10
+ open: (options) => config.open(options),
18
11
  close: () => {
19
12
  config.close()
20
13
  },
21
- getPayload,
22
- getContext: getPayload,
14
+ getPayload: <TPayload>() => config.getPayload() as TPayload,
23
15
  }
24
16
  }
25
17
  )
@@ -3,7 +3,6 @@ export type {
3
3
  ILightboxServiceConfig,
4
4
  ILightboxDefinition,
5
5
  LightboxPayload,
6
- LightboxContext,
7
6
  LightboxOpenOptions,
8
7
  LightboxOpenBySlugOptions,
9
8
  LightboxOpenByPageIdOptions,