@wix/site-service-pages 1.6.0 → 1.7.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,33 +1,32 @@
|
|
|
1
1
|
import type { ServiceDefinition } from '@wix/services-definitions';
|
|
2
2
|
/**
|
|
3
|
-
* A page on a site,
|
|
3
|
+
* A page on a site, as it appears in the `pages` map.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* It has no `id` property. The page's ID is its key in the `pages` map.
|
|
6
6
|
*/
|
|
7
7
|
export type PageConfig = {
|
|
8
8
|
/**
|
|
9
|
-
* Page title, as a Wix user
|
|
10
|
-
* site navigation menus.
|
|
9
|
+
* Page title, as a Wix user named the page in the editor.
|
|
11
10
|
*
|
|
12
|
-
* @exampleValue '
|
|
11
|
+
* @exampleValue 'Spring Collection'
|
|
13
12
|
*/
|
|
14
13
|
title: string;
|
|
15
14
|
/**
|
|
16
|
-
* Page path,
|
|
15
|
+
* Page path, relative to the site root URL.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) object.
|
|
17
|
+
* For a nested page, the path usually starts with its parent page's path, such as `collections/spring`.
|
|
18
|
+
* When a Wix user turns off URL hierarchy in the site's SEO settings, the path is just the page's own
|
|
19
|
+
* slug, such as `spring`. To find a page's parent, use `parentPageId`, not the path.
|
|
22
20
|
*
|
|
23
|
-
*
|
|
21
|
+
* To build the page's URL, join the site root URL and the path with a single `/`.
|
|
22
|
+
*
|
|
23
|
+
* @exampleValue 'collections/spring'
|
|
24
24
|
*/
|
|
25
25
|
path: string;
|
|
26
26
|
/**
|
|
27
|
-
* ID of
|
|
27
|
+
* ID of this page's parent page in the site's page structure.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
* no parent. The value is a key in the `pages` map.
|
|
29
|
+
* Undefined if the page doesn't have a parent page.
|
|
31
30
|
*
|
|
32
31
|
* @exampleValue 'i9xk2'
|
|
33
32
|
*/
|
|
@@ -35,40 +34,29 @@ export type PageConfig = {
|
|
|
35
34
|
/**
|
|
36
35
|
* Whether the page is a popup.
|
|
37
36
|
*
|
|
38
|
-
*
|
|
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.
|
|
37
|
+
* The `pages` map includes popups, so filter on this value before building links or navigation.
|
|
41
38
|
*
|
|
42
39
|
* @exampleValue false
|
|
43
40
|
*/
|
|
44
41
|
popup: boolean;
|
|
45
42
|
/**
|
|
46
|
-
* ID of the section
|
|
47
|
-
* Wix Stores product page or a Wix Bookings checkout page.
|
|
43
|
+
* ID of the app section this page provides.
|
|
48
44
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
45
|
+
* The ID stays the same across sites, even though a Wix user can change the page's path. It's unique
|
|
46
|
+
* only within its app, so another installed app can use the same ID.
|
|
51
47
|
*
|
|
52
|
-
* Available only for a page
|
|
48
|
+
* Available only for a page that belongs to an installed app.
|
|
53
49
|
*
|
|
54
50
|
* @exampleValue 'ecom_side_cart'
|
|
55
51
|
*/
|
|
56
52
|
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
|
-
*/
|
|
53
|
+
/** @internal Not documented: the host doesn't populate it yet (host PR #48632 set only `appPageId`). */
|
|
66
54
|
appDefinitionId?: string;
|
|
67
55
|
};
|
|
68
56
|
/** A page on a site, including its ID. */
|
|
69
57
|
export type Page = PageConfig & {
|
|
70
58
|
/**
|
|
71
|
-
* Page ID.
|
|
59
|
+
* Page ID.
|
|
72
60
|
*
|
|
73
61
|
* @exampleValue 'c1dmp'
|
|
74
62
|
*/
|
|
@@ -76,50 +64,52 @@ export type Page = PageConfig & {
|
|
|
76
64
|
};
|
|
77
65
|
/** Values the host supplies when it creates the service. */
|
|
78
66
|
export type IPagesServiceConfig = {
|
|
79
|
-
/**
|
|
67
|
+
/** Every page on the site, keyed by page ID. The values have no `id`. */
|
|
80
68
|
pages: {
|
|
81
69
|
[pageId: string]: PageConfig;
|
|
82
70
|
};
|
|
83
|
-
/**
|
|
71
|
+
/** The main page. The service stores it unchanged. */
|
|
84
72
|
mainPage: Page;
|
|
85
|
-
/**
|
|
73
|
+
/** The page that's currently displayed. The service stores it unchanged. */
|
|
86
74
|
currentPage: Page;
|
|
87
75
|
};
|
|
88
76
|
/**
|
|
89
|
-
* Provides
|
|
90
|
-
*
|
|
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.
|
|
77
|
+
* Provides every page on a Wix site, the page that's currently displayed, and the main page to code
|
|
78
|
+
* running on the site.
|
|
97
79
|
*/
|
|
98
80
|
export interface IPagesService {
|
|
99
81
|
/**
|
|
100
|
-
* Every page on
|
|
82
|
+
* Every page on the site, keyed by page ID.
|
|
83
|
+
*
|
|
84
|
+
* The values don't include an `id`. Use the key as the page's ID.
|
|
101
85
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
86
|
+
* Don't change the map or its pages. The property is read-only, but the map it returns isn't, and
|
|
87
|
+
* every component on the page shares it.
|
|
104
88
|
*
|
|
105
|
-
*
|
|
89
|
+
* @exampleValue `{ "m4rw8": { "title": "Home", "path": "home", "popup": false }, "c1dmp": { "title": "Shop", "path": "shop", "popup": false }, "i9xk2": { "title": "Collections", "path": "collections", "popup": false }, "t5nb6": { "title": "Spring Collection", "path": "collections/spring", "parentPageId": "i9xk2", "popup": false }, "q7hz3": { "title": "Side Cart", "path": "side-cart", "popup": true, "appPageId": "ecom_side_cart" } }`
|
|
106
90
|
*/
|
|
107
91
|
readonly pages: {
|
|
108
92
|
[pageId: string]: PageConfig;
|
|
109
93
|
};
|
|
110
94
|
/**
|
|
111
|
-
*
|
|
95
|
+
* Main page, the page a site visitor reaches at the site root URL.
|
|
96
|
+
*
|
|
97
|
+
* A Wix user chooses which page this is. To check whether the page that's currently displayed is the
|
|
98
|
+
* main page, compare `currentPage.id` with `mainPage.id`.
|
|
112
99
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
100
|
+
* Don't change its fields. The property is read-only, but the object it returns isn't, and every
|
|
101
|
+
* component on the page shares it.
|
|
102
|
+
*
|
|
103
|
+
* @exampleValue `{ "id": "m4rw8", "title": "Home", "path": "home", "popup": false }`
|
|
115
104
|
*/
|
|
116
105
|
readonly mainPage: Page;
|
|
117
106
|
/**
|
|
118
|
-
*
|
|
107
|
+
* Page that's currently displayed.
|
|
108
|
+
*
|
|
109
|
+
* Don't change its fields. The property is read-only, but the object it returns isn't, and every
|
|
110
|
+
* component on the page shares it.
|
|
119
111
|
*
|
|
120
|
-
*
|
|
121
|
-
* unchanged, so a popup can appear here. Check the page's `popup`
|
|
122
|
-
* property when that distinction matters.
|
|
112
|
+
* @exampleValue `{ "id": "c1dmp", "title": "Shop", "path": "shop", "popup": false }`
|
|
123
113
|
*/
|
|
124
114
|
readonly currentPage: Page;
|
|
125
115
|
/** @internal Host-only. Replaces config values when the host's state changes. */
|
|
@@ -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;AA4H5C,QAAA,eAAe,GAAG,IAAA,oCAAa,EAAqC,yBAAyB,CAAC,CAAA"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import type { ServiceDefinition } from '@wix/services-definitions';
|
|
2
2
|
/**
|
|
3
|
-
* A page on a site,
|
|
3
|
+
* A page on a site, as it appears in the `pages` map.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* It has no `id` property. The page's ID is its key in the `pages` map.
|
|
6
6
|
*/
|
|
7
7
|
export type PageConfig = {
|
|
8
8
|
/**
|
|
9
|
-
* Page title, as a Wix user
|
|
10
|
-
* site navigation menus.
|
|
9
|
+
* Page title, as a Wix user named the page in the editor.
|
|
11
10
|
*
|
|
12
|
-
* @exampleValue '
|
|
11
|
+
* @exampleValue 'Spring Collection'
|
|
13
12
|
*/
|
|
14
13
|
title: string;
|
|
15
14
|
/**
|
|
16
|
-
* Page path,
|
|
15
|
+
* Page path, relative to the site root URL.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) object.
|
|
17
|
+
* For a nested page, the path usually starts with its parent page's path, such as `collections/spring`.
|
|
18
|
+
* When a Wix user turns off URL hierarchy in the site's SEO settings, the path is just the page's own
|
|
19
|
+
* slug, such as `spring`. To find a page's parent, use `parentPageId`, not the path.
|
|
22
20
|
*
|
|
23
|
-
*
|
|
21
|
+
* To build the page's URL, join the site root URL and the path with a single `/`.
|
|
22
|
+
*
|
|
23
|
+
* @exampleValue 'collections/spring'
|
|
24
24
|
*/
|
|
25
25
|
path: string;
|
|
26
26
|
/**
|
|
27
|
-
* ID of
|
|
27
|
+
* ID of this page's parent page in the site's page structure.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
* no parent. The value is a key in the `pages` map.
|
|
29
|
+
* Undefined if the page doesn't have a parent page.
|
|
31
30
|
*
|
|
32
31
|
* @exampleValue 'i9xk2'
|
|
33
32
|
*/
|
|
@@ -35,40 +34,29 @@ export type PageConfig = {
|
|
|
35
34
|
/**
|
|
36
35
|
* Whether the page is a popup.
|
|
37
36
|
*
|
|
38
|
-
*
|
|
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.
|
|
37
|
+
* The `pages` map includes popups, so filter on this value before building links or navigation.
|
|
41
38
|
*
|
|
42
39
|
* @exampleValue false
|
|
43
40
|
*/
|
|
44
41
|
popup: boolean;
|
|
45
42
|
/**
|
|
46
|
-
* ID of the section
|
|
47
|
-
* Wix Stores product page or a Wix Bookings checkout page.
|
|
43
|
+
* ID of the app section this page provides.
|
|
48
44
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
45
|
+
* The ID stays the same across sites, even though a Wix user can change the page's path. It's unique
|
|
46
|
+
* only within its app, so another installed app can use the same ID.
|
|
51
47
|
*
|
|
52
|
-
* Available only for a page
|
|
48
|
+
* Available only for a page that belongs to an installed app.
|
|
53
49
|
*
|
|
54
50
|
* @exampleValue 'ecom_side_cart'
|
|
55
51
|
*/
|
|
56
52
|
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
|
-
*/
|
|
53
|
+
/** @internal Not documented: the host doesn't populate it yet (host PR #48632 set only `appPageId`). */
|
|
66
54
|
appDefinitionId?: string;
|
|
67
55
|
};
|
|
68
56
|
/** A page on a site, including its ID. */
|
|
69
57
|
export type Page = PageConfig & {
|
|
70
58
|
/**
|
|
71
|
-
* Page ID.
|
|
59
|
+
* Page ID.
|
|
72
60
|
*
|
|
73
61
|
* @exampleValue 'c1dmp'
|
|
74
62
|
*/
|
|
@@ -76,50 +64,52 @@ export type Page = PageConfig & {
|
|
|
76
64
|
};
|
|
77
65
|
/** Values the host supplies when it creates the service. */
|
|
78
66
|
export type IPagesServiceConfig = {
|
|
79
|
-
/**
|
|
67
|
+
/** Every page on the site, keyed by page ID. The values have no `id`. */
|
|
80
68
|
pages: {
|
|
81
69
|
[pageId: string]: PageConfig;
|
|
82
70
|
};
|
|
83
|
-
/**
|
|
71
|
+
/** The main page. The service stores it unchanged. */
|
|
84
72
|
mainPage: Page;
|
|
85
|
-
/**
|
|
73
|
+
/** The page that's currently displayed. The service stores it unchanged. */
|
|
86
74
|
currentPage: Page;
|
|
87
75
|
};
|
|
88
76
|
/**
|
|
89
|
-
* Provides
|
|
90
|
-
*
|
|
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.
|
|
77
|
+
* Provides every page on a Wix site, the page that's currently displayed, and the main page to code
|
|
78
|
+
* running on the site.
|
|
97
79
|
*/
|
|
98
80
|
export interface IPagesService {
|
|
99
81
|
/**
|
|
100
|
-
* Every page on
|
|
82
|
+
* Every page on the site, keyed by page ID.
|
|
83
|
+
*
|
|
84
|
+
* The values don't include an `id`. Use the key as the page's ID.
|
|
101
85
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
86
|
+
* Don't change the map or its pages. The property is read-only, but the map it returns isn't, and
|
|
87
|
+
* every component on the page shares it.
|
|
104
88
|
*
|
|
105
|
-
*
|
|
89
|
+
* @exampleValue `{ "m4rw8": { "title": "Home", "path": "home", "popup": false }, "c1dmp": { "title": "Shop", "path": "shop", "popup": false }, "i9xk2": { "title": "Collections", "path": "collections", "popup": false }, "t5nb6": { "title": "Spring Collection", "path": "collections/spring", "parentPageId": "i9xk2", "popup": false }, "q7hz3": { "title": "Side Cart", "path": "side-cart", "popup": true, "appPageId": "ecom_side_cart" } }`
|
|
106
90
|
*/
|
|
107
91
|
readonly pages: {
|
|
108
92
|
[pageId: string]: PageConfig;
|
|
109
93
|
};
|
|
110
94
|
/**
|
|
111
|
-
*
|
|
95
|
+
* Main page, the page a site visitor reaches at the site root URL.
|
|
96
|
+
*
|
|
97
|
+
* A Wix user chooses which page this is. To check whether the page that's currently displayed is the
|
|
98
|
+
* main page, compare `currentPage.id` with `mainPage.id`.
|
|
112
99
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
100
|
+
* Don't change its fields. The property is read-only, but the object it returns isn't, and every
|
|
101
|
+
* component on the page shares it.
|
|
102
|
+
*
|
|
103
|
+
* @exampleValue `{ "id": "m4rw8", "title": "Home", "path": "home", "popup": false }`
|
|
115
104
|
*/
|
|
116
105
|
readonly mainPage: Page;
|
|
117
106
|
/**
|
|
118
|
-
*
|
|
107
|
+
* Page that's currently displayed.
|
|
108
|
+
*
|
|
109
|
+
* Don't change its fields. The property is read-only, but the object it returns isn't, and every
|
|
110
|
+
* component on the page shares it.
|
|
119
111
|
*
|
|
120
|
-
*
|
|
121
|
-
* unchanged, so a popup can appear here. Check the page's `popup`
|
|
122
|
-
* property when that distinction matters.
|
|
112
|
+
* @exampleValue `{ "id": "c1dmp", "title": "Shop", "path": "shop", "popup": false }`
|
|
123
113
|
*/
|
|
124
114
|
readonly currentPage: Page;
|
|
125
115
|
/** @internal Host-only. Replaces config values when the host's state changes. */
|
|
@@ -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;AA4HzD,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.7.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"falconPackageHash": "
|
|
80
|
+
"falconPackageHash": "824488b92b2bde49e25e9c1f378ddd32847adfd2b0da037d3d25865f"
|
|
81
81
|
}
|
package/src/definition/index.ts
CHANGED
|
@@ -2,34 +2,33 @@ import { defineService } from '@wix/services-definitions'
|
|
|
2
2
|
import type { ServiceDefinition } from '@wix/services-definitions'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* A page on a site,
|
|
5
|
+
* A page on a site, as it appears in the `pages` map.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* It has no `id` property. The page's ID is its key in the `pages` map.
|
|
8
8
|
*/
|
|
9
9
|
export type PageConfig = {
|
|
10
10
|
/**
|
|
11
|
-
* Page title, as a Wix user
|
|
12
|
-
* site navigation menus.
|
|
11
|
+
* Page title, as a Wix user named the page in the editor.
|
|
13
12
|
*
|
|
14
|
-
* @exampleValue '
|
|
13
|
+
* @exampleValue 'Spring Collection'
|
|
15
14
|
*/
|
|
16
15
|
title: string
|
|
17
16
|
/**
|
|
18
|
-
* Page path,
|
|
17
|
+
* Page path, relative to the site root URL.
|
|
19
18
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) object.
|
|
19
|
+
* For a nested page, the path usually starts with its parent page's path, such as `collections/spring`.
|
|
20
|
+
* When a Wix user turns off URL hierarchy in the site's SEO settings, the path is just the page's own
|
|
21
|
+
* slug, such as `spring`. To find a page's parent, use `parentPageId`, not the path.
|
|
24
22
|
*
|
|
25
|
-
*
|
|
23
|
+
* To build the page's URL, join the site root URL and the path with a single `/`.
|
|
24
|
+
*
|
|
25
|
+
* @exampleValue 'collections/spring'
|
|
26
26
|
*/
|
|
27
27
|
path: string
|
|
28
28
|
/**
|
|
29
|
-
* ID of
|
|
29
|
+
* ID of this page's parent page in the site's page structure.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
* no parent. The value is a key in the `pages` map.
|
|
31
|
+
* Undefined if the page doesn't have a parent page.
|
|
33
32
|
*
|
|
34
33
|
* @exampleValue 'i9xk2'
|
|
35
34
|
*/
|
|
@@ -37,41 +36,30 @@ export type PageConfig = {
|
|
|
37
36
|
/**
|
|
38
37
|
* Whether the page is a popup.
|
|
39
38
|
*
|
|
40
|
-
*
|
|
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.
|
|
39
|
+
* The `pages` map includes popups, so filter on this value before building links or navigation.
|
|
43
40
|
*
|
|
44
41
|
* @exampleValue false
|
|
45
42
|
*/
|
|
46
43
|
popup: boolean
|
|
47
44
|
/**
|
|
48
|
-
* ID of the section
|
|
49
|
-
* Wix Stores product page or a Wix Bookings checkout page.
|
|
45
|
+
* ID of the app section this page provides.
|
|
50
46
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
47
|
+
* The ID stays the same across sites, even though a Wix user can change the page's path. It's unique
|
|
48
|
+
* only within its app, so another installed app can use the same ID.
|
|
53
49
|
*
|
|
54
|
-
* Available only for a page
|
|
50
|
+
* Available only for a page that belongs to an installed app.
|
|
55
51
|
*
|
|
56
52
|
* @exampleValue 'ecom_side_cart'
|
|
57
53
|
*/
|
|
58
54
|
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
|
-
*/
|
|
55
|
+
/** @internal Not documented: the host doesn't populate it yet (host PR #48632 set only `appPageId`). */
|
|
68
56
|
appDefinitionId?: string
|
|
69
57
|
}
|
|
70
58
|
|
|
71
59
|
/** A page on a site, including its ID. */
|
|
72
60
|
export type Page = PageConfig & {
|
|
73
61
|
/**
|
|
74
|
-
* Page ID.
|
|
62
|
+
* Page ID.
|
|
75
63
|
*
|
|
76
64
|
* @exampleValue 'c1dmp'
|
|
77
65
|
*/
|
|
@@ -80,49 +68,51 @@ export type Page = PageConfig & {
|
|
|
80
68
|
|
|
81
69
|
/** Values the host supplies when it creates the service. */
|
|
82
70
|
export type IPagesServiceConfig = {
|
|
83
|
-
/**
|
|
71
|
+
/** Every page on the site, keyed by page ID. The values have no `id`. */
|
|
84
72
|
pages: { [pageId: string]: PageConfig }
|
|
85
|
-
/**
|
|
73
|
+
/** The main page. The service stores it unchanged. */
|
|
86
74
|
mainPage: Page
|
|
87
|
-
/**
|
|
75
|
+
/** The page that's currently displayed. The service stores it unchanged. */
|
|
88
76
|
currentPage: Page
|
|
89
77
|
}
|
|
90
78
|
|
|
91
79
|
/**
|
|
92
|
-
* Provides
|
|
93
|
-
*
|
|
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.
|
|
80
|
+
* Provides every page on a Wix site, the page that's currently displayed, and the main page to code
|
|
81
|
+
* running on the site.
|
|
100
82
|
*/
|
|
101
83
|
export interface IPagesService {
|
|
102
84
|
/**
|
|
103
|
-
* Every page on
|
|
85
|
+
* Every page on the site, keyed by page ID.
|
|
86
|
+
*
|
|
87
|
+
* The values don't include an `id`. Use the key as the page's ID.
|
|
104
88
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
89
|
+
* Don't change the map or its pages. The property is read-only, but the map it returns isn't, and
|
|
90
|
+
* every component on the page shares it.
|
|
107
91
|
*
|
|
108
|
-
*
|
|
92
|
+
* @exampleValue `{ "m4rw8": { "title": "Home", "path": "home", "popup": false }, "c1dmp": { "title": "Shop", "path": "shop", "popup": false }, "i9xk2": { "title": "Collections", "path": "collections", "popup": false }, "t5nb6": { "title": "Spring Collection", "path": "collections/spring", "parentPageId": "i9xk2", "popup": false }, "q7hz3": { "title": "Side Cart", "path": "side-cart", "popup": true, "appPageId": "ecom_side_cart" } }`
|
|
109
93
|
*/
|
|
110
94
|
readonly pages: { [pageId: string]: PageConfig }
|
|
111
95
|
|
|
112
96
|
/**
|
|
113
|
-
*
|
|
97
|
+
* Main page, the page a site visitor reaches at the site root URL.
|
|
98
|
+
*
|
|
99
|
+
* A Wix user chooses which page this is. To check whether the page that's currently displayed is the
|
|
100
|
+
* main page, compare `currentPage.id` with `mainPage.id`.
|
|
114
101
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
102
|
+
* Don't change its fields. The property is read-only, but the object it returns isn't, and every
|
|
103
|
+
* component on the page shares it.
|
|
104
|
+
*
|
|
105
|
+
* @exampleValue `{ "id": "m4rw8", "title": "Home", "path": "home", "popup": false }`
|
|
117
106
|
*/
|
|
118
107
|
readonly mainPage: Page
|
|
119
108
|
|
|
120
109
|
/**
|
|
121
|
-
*
|
|
110
|
+
* Page that's currently displayed.
|
|
111
|
+
*
|
|
112
|
+
* Don't change its fields. The property is read-only, but the object it returns isn't, and every
|
|
113
|
+
* component on the page shares it.
|
|
122
114
|
*
|
|
123
|
-
*
|
|
124
|
-
* unchanged, so a popup can appear here. Check the page's `popup`
|
|
125
|
-
* property when that distinction matters.
|
|
115
|
+
* @exampleValue `{ "id": "c1dmp", "title": "Shop", "path": "shop", "popup": false }`
|
|
126
116
|
*/
|
|
127
117
|
readonly currentPage: Page
|
|
128
118
|
|