@wix/site-service-pages 1.3.0 → 1.5.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.
|
@@ -1,15 +1,80 @@
|
|
|
1
1
|
import type { ServiceDefinition } from '@wix/services-definitions';
|
|
2
|
+
/**
|
|
3
|
+
* A page on a site, without its ID.
|
|
4
|
+
*
|
|
5
|
+
* This is the value type of the `pages` map, where the map key is the page ID.
|
|
6
|
+
*/
|
|
2
7
|
export type PageConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* Page title, as a Wix user set it in the editor. This is the text shown in
|
|
10
|
+
* site navigation menus.
|
|
11
|
+
*
|
|
12
|
+
* @exampleValue 'Shop'
|
|
13
|
+
*/
|
|
3
14
|
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* Page path, as the host supplies it.
|
|
17
|
+
*
|
|
18
|
+
* The service stores the value unchanged and doesn't normalize it, so
|
|
19
|
+
* don't assume a leading slash. Join it to a base URL rather than
|
|
20
|
+
* concatenating, for example with the standard
|
|
21
|
+
* [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) object.
|
|
22
|
+
*
|
|
23
|
+
* @exampleValue 'shop'
|
|
24
|
+
*/
|
|
4
25
|
path: string;
|
|
26
|
+
/**
|
|
27
|
+
* ID of the page that this page sits under in the site's navigation.
|
|
28
|
+
*
|
|
29
|
+
* Available only for a page nested under another page. A top-level page has
|
|
30
|
+
* no parent. The value is a key in the `pages` map.
|
|
31
|
+
*
|
|
32
|
+
* @exampleValue 'i9xk2'
|
|
33
|
+
*/
|
|
5
34
|
parentPageId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the page is a popup.
|
|
37
|
+
*
|
|
38
|
+
* A popup opens over the page a visitor is already on rather than replacing
|
|
39
|
+
* it. Popups appear in the `pages` map alongside ordinary pages, so filter on
|
|
40
|
+
* this property to get only ordinary pages, or only popups.
|
|
41
|
+
*
|
|
42
|
+
* @exampleValue false
|
|
43
|
+
*/
|
|
6
44
|
popup: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* ID of the section that this page provides in the app that owns it, such as a
|
|
47
|
+
* Wix Stores product page or a Wix Bookings checkout page.
|
|
48
|
+
*
|
|
49
|
+
* This value is unique in an app but not across apps, so pair it with
|
|
50
|
+
* `appDefinitionId` to identify a page.
|
|
51
|
+
*
|
|
52
|
+
* Available only for a page belonging to an installed app.
|
|
53
|
+
*
|
|
54
|
+
* @exampleValue 'ecom_side_cart'
|
|
55
|
+
*/
|
|
7
56
|
appPageId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* ID of the app that owns this page. This is the app's `appDefinitionId`,
|
|
59
|
+
* which you can find in your app's dashboard. For an app created by Wix, see
|
|
60
|
+
* [Apps Created by Wix](https://dev.wix.com/docs/rest/articles/getting-started/apps-created-by-wix).
|
|
61
|
+
*
|
|
62
|
+
* Available only for a page belonging to an installed app.
|
|
63
|
+
*
|
|
64
|
+
* @exampleValue '1380b703-ce81-ff05-f115-39571d94dfcd'
|
|
65
|
+
*/
|
|
8
66
|
appDefinitionId?: string;
|
|
9
67
|
};
|
|
68
|
+
/** A page on a site, including its ID. */
|
|
10
69
|
export type Page = PageConfig & {
|
|
70
|
+
/**
|
|
71
|
+
* Page ID. This is the page's key in the `pages` map.
|
|
72
|
+
*
|
|
73
|
+
* @exampleValue 'c1dmp'
|
|
74
|
+
*/
|
|
11
75
|
id: string;
|
|
12
76
|
};
|
|
77
|
+
/** Values the host supplies when it creates the service. */
|
|
13
78
|
export type IPagesServiceConfig = {
|
|
14
79
|
/** id-as-key map; values omit `id` — callers use the key as the id (P3). */
|
|
15
80
|
pages: {
|
|
@@ -20,12 +85,44 @@ export type IPagesServiceConfig = {
|
|
|
20
85
|
/** Provider resolves and passes the full current page object; service stores it as-is. */
|
|
21
86
|
currentPage: Page;
|
|
22
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Provides the pages of a Wix site: every page the site has, the page a visitor
|
|
90
|
+
* is currently on, and the page a visitor reaches at the site root.
|
|
91
|
+
*
|
|
92
|
+
* Use it to build navigation, to read the title or path of the current page, and
|
|
93
|
+
* to find a page belonging to an installed Wix app.
|
|
94
|
+
*
|
|
95
|
+
* The service only provides values. It doesn't create or change pages, and it
|
|
96
|
+
* doesn't navigate a visitor between them.
|
|
97
|
+
*/
|
|
23
98
|
export interface IPagesService {
|
|
99
|
+
/**
|
|
100
|
+
* Every page on a site, keyed by page ID.
|
|
101
|
+
*
|
|
102
|
+
* The values in this map don't carry an `id` property. The key is the page's
|
|
103
|
+
* ID, so read it from the key or from the entry's position in the map.
|
|
104
|
+
*
|
|
105
|
+
* The map includes popups, which each page's `popup` property flags.
|
|
106
|
+
*/
|
|
24
107
|
readonly pages: {
|
|
25
108
|
[pageId: string]: PageConfig;
|
|
26
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* The page a visitor reaches at the site root.
|
|
112
|
+
*
|
|
113
|
+
* This is the page a Wix user set as the site's home page, which isn't
|
|
114
|
+
* necessarily the first page in `pages`.
|
|
115
|
+
*/
|
|
27
116
|
readonly mainPage: Page;
|
|
117
|
+
/**
|
|
118
|
+
* The page a visitor is currently on.
|
|
119
|
+
*
|
|
120
|
+
* The host decides which page this is and the service stores it
|
|
121
|
+
* unchanged, so a popup can appear here. Check the page's `popup`
|
|
122
|
+
* property when that distinction matters.
|
|
123
|
+
*/
|
|
28
124
|
readonly currentPage: Page;
|
|
125
|
+
/** @internal Host-only. Replaces config values when the host's state changes. */
|
|
29
126
|
_updateConfig: (config: Partial<IPagesServiceConfig>) => void;
|
|
30
127
|
}
|
|
31
128
|
export type IPagesDefinition = ServiceDefinition<IPagesService, IPagesServiceConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAsI5C,QAAA,eAAe,GAAG,IAAA,oCAAa,EAAqC,yBAAyB,CAAC,CAAA"}
|
|
@@ -1,15 +1,80 @@
|
|
|
1
1
|
import type { ServiceDefinition } from '@wix/services-definitions';
|
|
2
|
+
/**
|
|
3
|
+
* A page on a site, without its ID.
|
|
4
|
+
*
|
|
5
|
+
* This is the value type of the `pages` map, where the map key is the page ID.
|
|
6
|
+
*/
|
|
2
7
|
export type PageConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* Page title, as a Wix user set it in the editor. This is the text shown in
|
|
10
|
+
* site navigation menus.
|
|
11
|
+
*
|
|
12
|
+
* @exampleValue 'Shop'
|
|
13
|
+
*/
|
|
3
14
|
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* Page path, as the host supplies it.
|
|
17
|
+
*
|
|
18
|
+
* The service stores the value unchanged and doesn't normalize it, so
|
|
19
|
+
* don't assume a leading slash. Join it to a base URL rather than
|
|
20
|
+
* concatenating, for example with the standard
|
|
21
|
+
* [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) object.
|
|
22
|
+
*
|
|
23
|
+
* @exampleValue 'shop'
|
|
24
|
+
*/
|
|
4
25
|
path: string;
|
|
26
|
+
/**
|
|
27
|
+
* ID of the page that this page sits under in the site's navigation.
|
|
28
|
+
*
|
|
29
|
+
* Available only for a page nested under another page. A top-level page has
|
|
30
|
+
* no parent. The value is a key in the `pages` map.
|
|
31
|
+
*
|
|
32
|
+
* @exampleValue 'i9xk2'
|
|
33
|
+
*/
|
|
5
34
|
parentPageId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the page is a popup.
|
|
37
|
+
*
|
|
38
|
+
* A popup opens over the page a visitor is already on rather than replacing
|
|
39
|
+
* it. Popups appear in the `pages` map alongside ordinary pages, so filter on
|
|
40
|
+
* this property to get only ordinary pages, or only popups.
|
|
41
|
+
*
|
|
42
|
+
* @exampleValue false
|
|
43
|
+
*/
|
|
6
44
|
popup: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* ID of the section that this page provides in the app that owns it, such as a
|
|
47
|
+
* Wix Stores product page or a Wix Bookings checkout page.
|
|
48
|
+
*
|
|
49
|
+
* This value is unique in an app but not across apps, so pair it with
|
|
50
|
+
* `appDefinitionId` to identify a page.
|
|
51
|
+
*
|
|
52
|
+
* Available only for a page belonging to an installed app.
|
|
53
|
+
*
|
|
54
|
+
* @exampleValue 'ecom_side_cart'
|
|
55
|
+
*/
|
|
7
56
|
appPageId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* ID of the app that owns this page. This is the app's `appDefinitionId`,
|
|
59
|
+
* which you can find in your app's dashboard. For an app created by Wix, see
|
|
60
|
+
* [Apps Created by Wix](https://dev.wix.com/docs/rest/articles/getting-started/apps-created-by-wix).
|
|
61
|
+
*
|
|
62
|
+
* Available only for a page belonging to an installed app.
|
|
63
|
+
*
|
|
64
|
+
* @exampleValue '1380b703-ce81-ff05-f115-39571d94dfcd'
|
|
65
|
+
*/
|
|
8
66
|
appDefinitionId?: string;
|
|
9
67
|
};
|
|
68
|
+
/** A page on a site, including its ID. */
|
|
10
69
|
export type Page = PageConfig & {
|
|
70
|
+
/**
|
|
71
|
+
* Page ID. This is the page's key in the `pages` map.
|
|
72
|
+
*
|
|
73
|
+
* @exampleValue 'c1dmp'
|
|
74
|
+
*/
|
|
11
75
|
id: string;
|
|
12
76
|
};
|
|
77
|
+
/** Values the host supplies when it creates the service. */
|
|
13
78
|
export type IPagesServiceConfig = {
|
|
14
79
|
/** id-as-key map; values omit `id` — callers use the key as the id (P3). */
|
|
15
80
|
pages: {
|
|
@@ -20,12 +85,44 @@ export type IPagesServiceConfig = {
|
|
|
20
85
|
/** Provider resolves and passes the full current page object; service stores it as-is. */
|
|
21
86
|
currentPage: Page;
|
|
22
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Provides the pages of a Wix site: every page the site has, the page a visitor
|
|
90
|
+
* is currently on, and the page a visitor reaches at the site root.
|
|
91
|
+
*
|
|
92
|
+
* Use it to build navigation, to read the title or path of the current page, and
|
|
93
|
+
* to find a page belonging to an installed Wix app.
|
|
94
|
+
*
|
|
95
|
+
* The service only provides values. It doesn't create or change pages, and it
|
|
96
|
+
* doesn't navigate a visitor between them.
|
|
97
|
+
*/
|
|
23
98
|
export interface IPagesService {
|
|
99
|
+
/**
|
|
100
|
+
* Every page on a site, keyed by page ID.
|
|
101
|
+
*
|
|
102
|
+
* The values in this map don't carry an `id` property. The key is the page's
|
|
103
|
+
* ID, so read it from the key or from the entry's position in the map.
|
|
104
|
+
*
|
|
105
|
+
* The map includes popups, which each page's `popup` property flags.
|
|
106
|
+
*/
|
|
24
107
|
readonly pages: {
|
|
25
108
|
[pageId: string]: PageConfig;
|
|
26
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* The page a visitor reaches at the site root.
|
|
112
|
+
*
|
|
113
|
+
* This is the page a Wix user set as the site's home page, which isn't
|
|
114
|
+
* necessarily the first page in `pages`.
|
|
115
|
+
*/
|
|
27
116
|
readonly mainPage: Page;
|
|
117
|
+
/**
|
|
118
|
+
* The page a visitor is currently on.
|
|
119
|
+
*
|
|
120
|
+
* The host decides which page this is and the service stores it
|
|
121
|
+
* unchanged, so a popup can appear here. Check the page's `popup`
|
|
122
|
+
* property when that distinction matters.
|
|
123
|
+
*/
|
|
28
124
|
readonly currentPage: Page;
|
|
125
|
+
/** @internal Host-only. Replaces config values when the host's state changes. */
|
|
29
126
|
_updateConfig: (config: Partial<IPagesServiceConfig>) => void;
|
|
30
127
|
}
|
|
31
128
|
export type IPagesDefinition = ServiceDefinition<IPagesService, IPagesServiceConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAsIzD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAqC,yBAAyB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/site-service-pages",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"build": "tsc -b
|
|
50
|
+
"build": "tsc -b . && tsc --project tsconfig.cjs.json",
|
|
51
51
|
"lint": "yarn run -T lint:package $npm_package_name",
|
|
52
52
|
"test": "vitest --run && yarn test-type-check",
|
|
53
53
|
"test-type-check": "echo 'validating typescript in test files' && tsc --project tsconfig.test.json && echo 'Finished validating typescript in test files successfully'"
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"falconPackageHash": "
|
|
80
|
+
"falconPackageHash": "ad192fc40720e725d6745fc6e25b6368849f4a2f93aa002f6c0de021"
|
|
81
81
|
}
|
package/src/definition/index.ts
CHANGED
|
@@ -1,19 +1,84 @@
|
|
|
1
1
|
import { defineService } from '@wix/services-definitions'
|
|
2
2
|
import type { ServiceDefinition } from '@wix/services-definitions'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A page on a site, without its ID.
|
|
6
|
+
*
|
|
7
|
+
* This is the value type of the `pages` map, where the map key is the page ID.
|
|
8
|
+
*/
|
|
4
9
|
export type PageConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* Page title, as a Wix user set it in the editor. This is the text shown in
|
|
12
|
+
* site navigation menus.
|
|
13
|
+
*
|
|
14
|
+
* @exampleValue 'Shop'
|
|
15
|
+
*/
|
|
5
16
|
title: string
|
|
17
|
+
/**
|
|
18
|
+
* Page path, as the host supplies it.
|
|
19
|
+
*
|
|
20
|
+
* The service stores the value unchanged and doesn't normalize it, so
|
|
21
|
+
* don't assume a leading slash. Join it to a base URL rather than
|
|
22
|
+
* concatenating, for example with the standard
|
|
23
|
+
* [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) object.
|
|
24
|
+
*
|
|
25
|
+
* @exampleValue 'shop'
|
|
26
|
+
*/
|
|
6
27
|
path: string
|
|
28
|
+
/**
|
|
29
|
+
* ID of the page that this page sits under in the site's navigation.
|
|
30
|
+
*
|
|
31
|
+
* Available only for a page nested under another page. A top-level page has
|
|
32
|
+
* no parent. The value is a key in the `pages` map.
|
|
33
|
+
*
|
|
34
|
+
* @exampleValue 'i9xk2'
|
|
35
|
+
*/
|
|
7
36
|
parentPageId?: string
|
|
37
|
+
/**
|
|
38
|
+
* Whether the page is a popup.
|
|
39
|
+
*
|
|
40
|
+
* A popup opens over the page a visitor is already on rather than replacing
|
|
41
|
+
* it. Popups appear in the `pages` map alongside ordinary pages, so filter on
|
|
42
|
+
* this property to get only ordinary pages, or only popups.
|
|
43
|
+
*
|
|
44
|
+
* @exampleValue false
|
|
45
|
+
*/
|
|
8
46
|
popup: boolean
|
|
47
|
+
/**
|
|
48
|
+
* ID of the section that this page provides in the app that owns it, such as a
|
|
49
|
+
* Wix Stores product page or a Wix Bookings checkout page.
|
|
50
|
+
*
|
|
51
|
+
* This value is unique in an app but not across apps, so pair it with
|
|
52
|
+
* `appDefinitionId` to identify a page.
|
|
53
|
+
*
|
|
54
|
+
* Available only for a page belonging to an installed app.
|
|
55
|
+
*
|
|
56
|
+
* @exampleValue 'ecom_side_cart'
|
|
57
|
+
*/
|
|
9
58
|
appPageId?: string
|
|
59
|
+
/**
|
|
60
|
+
* ID of the app that owns this page. This is the app's `appDefinitionId`,
|
|
61
|
+
* which you can find in your app's dashboard. For an app created by Wix, see
|
|
62
|
+
* [Apps Created by Wix](https://dev.wix.com/docs/rest/articles/getting-started/apps-created-by-wix).
|
|
63
|
+
*
|
|
64
|
+
* Available only for a page belonging to an installed app.
|
|
65
|
+
*
|
|
66
|
+
* @exampleValue '1380b703-ce81-ff05-f115-39571d94dfcd'
|
|
67
|
+
*/
|
|
10
68
|
appDefinitionId?: string
|
|
11
69
|
}
|
|
12
70
|
|
|
71
|
+
/** A page on a site, including its ID. */
|
|
13
72
|
export type Page = PageConfig & {
|
|
73
|
+
/**
|
|
74
|
+
* Page ID. This is the page's key in the `pages` map.
|
|
75
|
+
*
|
|
76
|
+
* @exampleValue 'c1dmp'
|
|
77
|
+
*/
|
|
14
78
|
id: string
|
|
15
79
|
}
|
|
16
80
|
|
|
81
|
+
/** Values the host supplies when it creates the service. */
|
|
17
82
|
export type IPagesServiceConfig = {
|
|
18
83
|
/** id-as-key map; values omit `id` — callers use the key as the id (P3). */
|
|
19
84
|
pages: { [pageId: string]: PageConfig }
|
|
@@ -23,10 +88,45 @@ export type IPagesServiceConfig = {
|
|
|
23
88
|
currentPage: Page
|
|
24
89
|
}
|
|
25
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Provides the pages of a Wix site: every page the site has, the page a visitor
|
|
93
|
+
* is currently on, and the page a visitor reaches at the site root.
|
|
94
|
+
*
|
|
95
|
+
* Use it to build navigation, to read the title or path of the current page, and
|
|
96
|
+
* to find a page belonging to an installed Wix app.
|
|
97
|
+
*
|
|
98
|
+
* The service only provides values. It doesn't create or change pages, and it
|
|
99
|
+
* doesn't navigate a visitor between them.
|
|
100
|
+
*/
|
|
26
101
|
export interface IPagesService {
|
|
102
|
+
/**
|
|
103
|
+
* Every page on a site, keyed by page ID.
|
|
104
|
+
*
|
|
105
|
+
* The values in this map don't carry an `id` property. The key is the page's
|
|
106
|
+
* ID, so read it from the key or from the entry's position in the map.
|
|
107
|
+
*
|
|
108
|
+
* The map includes popups, which each page's `popup` property flags.
|
|
109
|
+
*/
|
|
27
110
|
readonly pages: { [pageId: string]: PageConfig }
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The page a visitor reaches at the site root.
|
|
114
|
+
*
|
|
115
|
+
* This is the page a Wix user set as the site's home page, which isn't
|
|
116
|
+
* necessarily the first page in `pages`.
|
|
117
|
+
*/
|
|
28
118
|
readonly mainPage: Page
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The page a visitor is currently on.
|
|
122
|
+
*
|
|
123
|
+
* The host decides which page this is and the service stores it
|
|
124
|
+
* unchanged, so a popup can appear here. Check the page's `popup`
|
|
125
|
+
* property when that distinction matters.
|
|
126
|
+
*/
|
|
29
127
|
readonly currentPage: Page
|
|
128
|
+
|
|
129
|
+
/** @internal Host-only. Replaces config values when the host's state changes. */
|
|
30
130
|
_updateConfig: (config: Partial<IPagesServiceConfig>) => void
|
|
31
131
|
}
|
|
32
132
|
|