pageflow 15.2.2 → 15.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -118
- data/README.md +2 -3
- data/admins/pageflow/accounts.rb +1 -98
- data/admins/pageflow/entry.rb +21 -1
- data/admins/pageflow/entry_templates.rb +140 -0
- data/admins/pageflow/membership.rb +12 -0
- data/admins/pageflow/user.rb +5 -5
- data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
- data/app/assets/javascripts/pageflow/admin/users.js +1 -1
- data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
- data/app/assets/javascripts/pageflow/base.js +0 -12
- data/app/assets/javascripts/pageflow/components.js +2 -6
- data/app/assets/javascripts/pageflow/dist/ui.js +178 -55
- data/app/assets/javascripts/pageflow/editor/vendor.js +1 -0
- data/app/assets/javascripts/pageflow/vendor.js +12 -10
- data/app/assets/stylesheets/pageflow/base.scss +0 -7
- data/app/assets/stylesheets/pageflow/editor/base.scss +5 -2
- data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
- data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
- data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -1
- data/app/assets/stylesheets/pageflow/entries.scss +1 -1
- data/app/assets/stylesheets/pageflow/loading_spinner.scss +4 -1
- data/app/assets/stylesheets/pageflow/navigation_mobile.scss +4 -4
- data/app/assets/stylesheets/pageflow/themes/default/anchors.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/page.scss +7 -0
- data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/control_bar.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/info_box.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/shared/menu_bar.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/control_bar.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/info_box.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/quality_menu.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/waveform/wave.scss +1 -1
- data/app/assets/stylesheets/pageflow/ui/forms.scss +9 -2
- data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +2 -2
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
- data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
- data/app/helpers/pageflow/structured_data_helper.rb +0 -2
- data/app/models/pageflow/account.rb +21 -1
- data/app/models/pageflow/account_role_query.rb +1 -1
- data/app/models/pageflow/chapter.rb +3 -9
- data/app/models/pageflow/entry.rb +9 -2
- data/app/models/pageflow/entry_duplicate.rb +1 -0
- data/app/models/pageflow/entry_template.rb +16 -2
- data/app/models/pageflow/managed_user_query.rb +1 -1
- data/app/models/pageflow/page.rb +1 -4
- data/app/models/pageflow/revision.rb +0 -4
- data/app/models/pageflow/storyline.rb +2 -9
- data/app/policies/pageflow/account_policy.rb +10 -0
- data/app/policies/pageflow/entry_template_policy.rb +5 -1
- data/app/policies/pageflow/folder_policy.rb +2 -2
- data/app/policies/pageflow/membership_policy.rb +2 -2
- data/app/policies/pageflow/theming_policy.rb +2 -2
- data/app/policies/pageflow/user_policy.rb +1 -1
- data/app/views/admin/accounts/_entry_template_details.html.arb +7 -5
- data/app/views/admin/accounts/_form.html.erb +3 -49
- data/app/views/admin/entries/_attributes_table.html.arb +5 -0
- data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
- data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
- data/app/views/admin/entry_templates/_form.html.erb +58 -0
- data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
- data/app/views/pageflow/admin/initial_passwords/edit.html.erb +2 -1
- data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
- data/app/views/pageflow/themes/_theme.json.jbuilder +1 -1
- data/app/views/pageflow/video_files/_video_file.json.jbuilder +8 -1
- data/config/initializers/admin_resource_tabs.rb +5 -0
- data/config/initializers/help_entries.rb +1 -5
- data/config/initializers/revision_components.rb +5 -0
- data/config/locales/de.yml +88 -155
- data/config/locales/en.yml +79 -143
- data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
- data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1528 -1349
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9258 -0
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/videojs.js +6 -0
- data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
- data/entry_types/paged/app/views/layouts/pageflow_paged/_loading_spinner_inline_script.html.erb +1 -0
- data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +3 -3
- data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +4 -2
- data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
- data/entry_types/paged/config/initializers/features.rb +1 -1
- data/entry_types/paged/config/initializers/help_entries.rb +17 -0
- data/entry_types/paged/config/locales/new/help.de.yml +162 -0
- data/entry_types/paged/config/locales/new/help.en.yml +153 -0
- data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
- data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
- data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
- data/entry_types/paged/lib/tasks/pageflow_paged_tasks.rake +7 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/dash.all.min.js +0 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs-dash.js +0 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs.js +0 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
- data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +14 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +10 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +7 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/favicon_helper.rb +21 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +40 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +36 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +3 -9
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +37 -2
- data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +3 -9
- data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +1 -9
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/_global_notices.html.erb +10 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +28 -11
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +8 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/favicons/_entry.html.erb +10 -0
- data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
- data/entry_types/scrolled/config/locales/de.yml +669 -0
- data/entry_types/scrolled/config/locales/en.yml +488 -0
- data/entry_types/scrolled/config/routes.rb +1 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +76 -6
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-192x192.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-512x512.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/apple-touch-icon.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/browserconfig.xml +9 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-16x16.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-32x32.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon.ico +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/mstile-150x150.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/safari-pinned-tab.svg +46 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/site.webmanifest +19 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/unmute.mp3 +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +26 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +6 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +90 -30
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/create_bundle_symlinks_for_yarn.rake +33 -0
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +8 -0
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +173 -0
- data/entry_types/scrolled/package/config/webpack.js +11 -0
- data/entry_types/scrolled/package/contentElements-editor.js +316 -185
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements-frontend.js +940 -304
- data/entry_types/scrolled/package/editor.js +2930 -371
- data/entry_types/scrolled/package/frontend-server.js +228 -0
- data/entry_types/scrolled/package/frontend/EditableText-7093fd0e.js +1071 -0
- data/entry_types/scrolled/package/frontend/Viewer-e49e7807.js +387 -0
- data/entry_types/scrolled/package/frontend/Wavesurfer-0adf5667.js +375 -0
- data/entry_types/scrolled/package/frontend/components-6a6793ca.js +2534 -0
- data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
- data/entry_types/scrolled/package/frontend/i18n-4dc6c377.js +1092 -0
- data/entry_types/scrolled/package/frontend/index.css +9 -0
- data/entry_types/scrolled/package/frontend/index.js +5686 -0
- data/entry_types/scrolled/package/frontend/useBrowserFeature-91a4c29d.js +33 -0
- data/entry_types/scrolled/package/package.json +30 -9
- data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
- data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +14 -9
- data/lib/pageflow/ability_mixin.rb +14 -2
- data/lib/pageflow/configuration.rb +6 -5
- data/lib/pageflow/entry_export_import/revision_serialization.rb +15 -13
- data/lib/pageflow/entry_export_import/revision_serialization/import.rb +18 -26
- data/lib/pageflow/entry_type_configuration.rb +2 -0
- data/lib/pageflow/global_config_api.rb +5 -4
- data/lib/pageflow/nested_revision_component.rb +49 -0
- data/lib/pageflow/react.rb +4 -2
- data/lib/pageflow/revision_component.rb +6 -2
- data/lib/pageflow/themes.rb +4 -0
- data/lib/pageflow/user_mixin.rb +2 -1
- data/lib/pageflow/version.rb +1 -1
- data/{packages/pageflow → package}/config/jest/index.js +8 -2
- data/{packages/pageflow → package}/config/jest/transformers/jst.js +0 -0
- data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
- data/{packages/pageflow → package}/config/webpack.js +7 -0
- data/{packages/pageflow → package}/editor.js +482 -1130
- data/package/frontend.js +2553 -0
- data/{packages/pageflow → package}/package.json +3 -0
- data/{packages/pageflow → package}/testHelpers.js +114 -13
- data/{packages/pageflow → package}/ui.js +178 -55
- data/spec/factories/accounts.rb +3 -1
- data/spec/factories/entry_templates.rb +1 -0
- data/spec/factories/published_entries.rb +6 -1
- data/spec/factories/test_revision_components.rb +4 -0
- metadata +95 -36
- data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5800
- data/app/assets/javascripts/pageflow/videojs.js +0 -6
- data/config/initializers/entry_types.rb +0 -4
- data/entry_types/scrolled/config/locales/new/de.yml +0 -269
- data/entry_types/scrolled/config/locales/new/en.yml +0 -264
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +0 -96
- data/entry_types/scrolled/package/frontend.js +0 -2879
- data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
@@ -0,0 +1,86 @@
|
|
1
|
+
function _classCallCheck(instance, Constructor) {
|
2
|
+
if (!(instance instanceof Constructor)) {
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
4
|
+
}
|
5
|
+
}
|
6
|
+
|
7
|
+
function _defineProperties(target, props) {
|
8
|
+
for (var i = 0; i < props.length; i++) {
|
9
|
+
var descriptor = props[i];
|
10
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
11
|
+
descriptor.configurable = true;
|
12
|
+
if ("value" in descriptor) descriptor.writable = true;
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
18
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
19
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
20
|
+
return Constructor;
|
21
|
+
}
|
22
|
+
|
23
|
+
function _setPrototypeOf(o, p) {
|
24
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
25
|
+
o.__proto__ = p;
|
26
|
+
return o;
|
27
|
+
};
|
28
|
+
|
29
|
+
return _setPrototypeOf(o, p);
|
30
|
+
}
|
31
|
+
|
32
|
+
function _inherits(subClass, superClass) {
|
33
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
34
|
+
throw new TypeError("Super expression must either be null or a function");
|
35
|
+
}
|
36
|
+
|
37
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
38
|
+
constructor: {
|
39
|
+
value: subClass,
|
40
|
+
writable: true,
|
41
|
+
configurable: true
|
42
|
+
}
|
43
|
+
});
|
44
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
45
|
+
}
|
46
|
+
|
47
|
+
function _typeof(obj) {
|
48
|
+
"@babel/helpers - typeof";
|
49
|
+
|
50
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
51
|
+
_typeof = function _typeof(obj) {
|
52
|
+
return typeof obj;
|
53
|
+
};
|
54
|
+
} else {
|
55
|
+
_typeof = function _typeof(obj) {
|
56
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
57
|
+
};
|
58
|
+
}
|
59
|
+
|
60
|
+
return _typeof(obj);
|
61
|
+
}
|
62
|
+
|
63
|
+
function _assertThisInitialized(self) {
|
64
|
+
if (self === void 0) {
|
65
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
66
|
+
}
|
67
|
+
|
68
|
+
return self;
|
69
|
+
}
|
70
|
+
|
71
|
+
function _possibleConstructorReturn(self, call) {
|
72
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
73
|
+
return call;
|
74
|
+
}
|
75
|
+
|
76
|
+
return _assertThisInitialized(self);
|
77
|
+
}
|
78
|
+
|
79
|
+
function _getPrototypeOf(o) {
|
80
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
81
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
82
|
+
};
|
83
|
+
return _getPrototypeOf(o);
|
84
|
+
}
|
85
|
+
|
86
|
+
export { _createClass as _, _classCallCheck as a, _inherits as b, _getPrototypeOf as c, _possibleConstructorReturn as d, _assertThisInitialized as e };
|
@@ -0,0 +1,1092 @@
|
|
1
|
+
import React, { useReducer, useMemo, useCallback, createContext as createContext$1, useContext } from 'react';
|
2
|
+
import { createContext, useContextSelector } from 'use-context-selector';
|
3
|
+
import { createSelectorCreator, defaultMemoize, createSelector } from 'reselect';
|
4
|
+
import I18n from 'i18n-js';
|
5
|
+
import slugify from 'slugify';
|
6
|
+
|
7
|
+
function _defineProperty(obj, key, value) {
|
8
|
+
if (key in obj) {
|
9
|
+
Object.defineProperty(obj, key, {
|
10
|
+
value: value,
|
11
|
+
enumerable: true,
|
12
|
+
configurable: true,
|
13
|
+
writable: true
|
14
|
+
});
|
15
|
+
} else {
|
16
|
+
obj[key] = value;
|
17
|
+
}
|
18
|
+
|
19
|
+
return obj;
|
20
|
+
}
|
21
|
+
|
22
|
+
function _arrayWithHoles(arr) {
|
23
|
+
if (Array.isArray(arr)) return arr;
|
24
|
+
}
|
25
|
+
|
26
|
+
function _iterableToArrayLimit(arr, i) {
|
27
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
28
|
+
var _arr = [];
|
29
|
+
var _n = true;
|
30
|
+
var _d = false;
|
31
|
+
var _e = undefined;
|
32
|
+
|
33
|
+
try {
|
34
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
35
|
+
_arr.push(_s.value);
|
36
|
+
|
37
|
+
if (i && _arr.length === i) break;
|
38
|
+
}
|
39
|
+
} catch (err) {
|
40
|
+
_d = true;
|
41
|
+
_e = err;
|
42
|
+
} finally {
|
43
|
+
try {
|
44
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
45
|
+
} finally {
|
46
|
+
if (_d) throw _e;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
return _arr;
|
51
|
+
}
|
52
|
+
|
53
|
+
function _arrayLikeToArray(arr, len) {
|
54
|
+
if (len == null || len > arr.length) len = arr.length;
|
55
|
+
|
56
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
57
|
+
arr2[i] = arr[i];
|
58
|
+
}
|
59
|
+
|
60
|
+
return arr2;
|
61
|
+
}
|
62
|
+
|
63
|
+
function _unsupportedIterableToArray(o, minLen) {
|
64
|
+
if (!o) return;
|
65
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
66
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
67
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
68
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
69
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
70
|
+
}
|
71
|
+
|
72
|
+
function _nonIterableRest() {
|
73
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
74
|
+
}
|
75
|
+
|
76
|
+
function _slicedToArray(arr, i) {
|
77
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
78
|
+
}
|
79
|
+
|
80
|
+
function ownKeys(object, enumerableOnly) {
|
81
|
+
var keys = Object.keys(object);
|
82
|
+
|
83
|
+
if (Object.getOwnPropertySymbols) {
|
84
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
85
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
86
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
87
|
+
});
|
88
|
+
keys.push.apply(keys, symbols);
|
89
|
+
}
|
90
|
+
|
91
|
+
return keys;
|
92
|
+
}
|
93
|
+
|
94
|
+
function _objectSpread2(target) {
|
95
|
+
for (var i = 1; i < arguments.length; i++) {
|
96
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
97
|
+
|
98
|
+
if (i % 2) {
|
99
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
100
|
+
_defineProperty(target, key, source[key]);
|
101
|
+
});
|
102
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
103
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
104
|
+
} else {
|
105
|
+
ownKeys(Object(source)).forEach(function (key) {
|
106
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
107
|
+
});
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
return target;
|
112
|
+
}
|
113
|
+
|
114
|
+
var PREFIX = 'PAGEFLOW_SCROLLED_COLLECTION';
|
115
|
+
var RESET = "".concat(PREFIX, "_RESET");
|
116
|
+
var ADD = "".concat(PREFIX, "_ADD");
|
117
|
+
var CHANGE = "".concat(PREFIX, "_CHANGE");
|
118
|
+
var PATCH_CONFIGURATION = "".concat(PREFIX, "_PATCH_CONFIGURATION");
|
119
|
+
var REMOVE = "".concat(PREFIX, "_REMOVE");
|
120
|
+
var SORT = "".concat(PREFIX, "_SORT");
|
121
|
+
function useCollections() {
|
122
|
+
var seed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
123
|
+
|
124
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
125
|
+
keyAttribute = _ref.keyAttribute;
|
126
|
+
|
127
|
+
return useReducer(reducer, Object.keys(seed).reduce(function (result, key) {
|
128
|
+
result[key] = init(seed[key], keyAttribute);
|
129
|
+
return result;
|
130
|
+
}, {}));
|
131
|
+
}
|
132
|
+
|
133
|
+
function reducer(state, action) {
|
134
|
+
var collectionName = action.payload.collectionName;
|
135
|
+
var keyAttribute = action.payload.keyAttribute;
|
136
|
+
|
137
|
+
switch (action.type) {
|
138
|
+
case RESET:
|
139
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, init(action.payload.items, keyAttribute)));
|
140
|
+
|
141
|
+
case ADD:
|
142
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
|
143
|
+
order: action.payload.order,
|
144
|
+
items: _objectSpread2(_objectSpread2({}, state[collectionName].items), {}, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
|
145
|
+
}));
|
146
|
+
|
147
|
+
case CHANGE:
|
148
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
|
149
|
+
order: state[collectionName].order,
|
150
|
+
items: _objectSpread2(_objectSpread2({}, state[collectionName].items), {}, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
|
151
|
+
}));
|
152
|
+
|
153
|
+
case PATCH_CONFIGURATION:
|
154
|
+
var key = action.payload.key;
|
155
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
|
156
|
+
order: state[collectionName].order,
|
157
|
+
items: _objectSpread2(_objectSpread2({}, state[collectionName].items), {}, _defineProperty({}, key, _objectSpread2(_objectSpread2({}, state[collectionName].items[key]), {}, {
|
158
|
+
configuration: _objectSpread2(_objectSpread2({}, state[collectionName].items[key].configuration), action.payload.configuration)
|
159
|
+
})))
|
160
|
+
}));
|
161
|
+
|
162
|
+
case REMOVE:
|
163
|
+
var clonedItems = _objectSpread2({}, state[collectionName].items);
|
164
|
+
|
165
|
+
delete clonedItems[action.payload.key];
|
166
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
|
167
|
+
order: action.payload.order,
|
168
|
+
items: clonedItems
|
169
|
+
}));
|
170
|
+
|
171
|
+
case SORT:
|
172
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
|
173
|
+
order: action.payload.order,
|
174
|
+
items: state[collectionName].items
|
175
|
+
}));
|
176
|
+
|
177
|
+
default:
|
178
|
+
return state;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
function init(items) {
|
183
|
+
var keyAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
|
184
|
+
items = items.filter(function (item) {
|
185
|
+
return item[keyAttribute];
|
186
|
+
});
|
187
|
+
return {
|
188
|
+
order: items.map(function (item) {
|
189
|
+
return item[keyAttribute];
|
190
|
+
}),
|
191
|
+
items: items.reduce(function (result, item) {
|
192
|
+
result[item[keyAttribute]] = item;
|
193
|
+
return result;
|
194
|
+
}, {})
|
195
|
+
};
|
196
|
+
}
|
197
|
+
|
198
|
+
function updateConfiguration(_ref2) {
|
199
|
+
var dispatch = _ref2.dispatch,
|
200
|
+
name = _ref2.name,
|
201
|
+
key = _ref2.key,
|
202
|
+
configuration = _ref2.configuration;
|
203
|
+
dispatch({
|
204
|
+
type: PATCH_CONFIGURATION,
|
205
|
+
payload: {
|
206
|
+
collectionName: name,
|
207
|
+
key: key,
|
208
|
+
configuration: configuration
|
209
|
+
}
|
210
|
+
});
|
211
|
+
}
|
212
|
+
function getItem(state, collectionName, key) {
|
213
|
+
if (state[collectionName]) {
|
214
|
+
return state[collectionName].items[key];
|
215
|
+
}
|
216
|
+
}
|
217
|
+
function createItemsSelector(collectionName, filter) {
|
218
|
+
if (filter) {
|
219
|
+
var itemsSelector = createItemsSelector(collectionName);
|
220
|
+
return createShallowEqualArraysSelector(function (collections) {
|
221
|
+
return itemsSelector(collections).filter(filter);
|
222
|
+
}, function (items) {
|
223
|
+
return items;
|
224
|
+
});
|
225
|
+
}
|
226
|
+
|
227
|
+
return createSelector(function (collections) {
|
228
|
+
return collections[collectionName];
|
229
|
+
}, function (collection) {
|
230
|
+
if (collection) {
|
231
|
+
var items = collection.items;
|
232
|
+
return collection.order.map(function (key) {
|
233
|
+
return items[key];
|
234
|
+
});
|
235
|
+
} else {
|
236
|
+
return [];
|
237
|
+
}
|
238
|
+
});
|
239
|
+
}
|
240
|
+
var createShallowEqualArraysSelector = createSelectorCreator(defaultMemoize, shallowEqualArrays);
|
241
|
+
|
242
|
+
function shallowEqualArrays(a, b) {
|
243
|
+
return a.length === b.length && a.every(function (item, index) {
|
244
|
+
return item === b[index];
|
245
|
+
});
|
246
|
+
}
|
247
|
+
|
248
|
+
var Context = createContext();
|
249
|
+
function EntryStateProvider(_ref) {
|
250
|
+
var seed = _ref.seed,
|
251
|
+
children = _ref.children;
|
252
|
+
|
253
|
+
var _useCollections = useCollections(seed.collections, {
|
254
|
+
keyAttribute: 'permaId'
|
255
|
+
}),
|
256
|
+
_useCollections2 = _slicedToArray(_useCollections, 2),
|
257
|
+
collections = _useCollections2[0],
|
258
|
+
dispatch = _useCollections2[1];
|
259
|
+
|
260
|
+
var value = useMemo(function () {
|
261
|
+
return {
|
262
|
+
entryState: {
|
263
|
+
collections: collections,
|
264
|
+
config: seed.config
|
265
|
+
},
|
266
|
+
dispatch: dispatch
|
267
|
+
};
|
268
|
+
}, [collections, dispatch, seed]);
|
269
|
+
return (
|
270
|
+
/*#__PURE__*/
|
271
|
+
React.createElement(Context.Provider, {
|
272
|
+
value: value
|
273
|
+
}, children)
|
274
|
+
);
|
275
|
+
}
|
276
|
+
|
277
|
+
function useEntryState() {
|
278
|
+
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (entryState) {
|
279
|
+
return entryState;
|
280
|
+
};
|
281
|
+
return useContextSelector(Context, function (value) {
|
282
|
+
return selector(value.entryState);
|
283
|
+
});
|
284
|
+
}
|
285
|
+
|
286
|
+
function useEntryStateDispatch() {
|
287
|
+
return useContextSelector(Context, function (value) {
|
288
|
+
return value.dispatch;
|
289
|
+
});
|
290
|
+
}
|
291
|
+
function useEntryStateConfig() {
|
292
|
+
return useEntryState(function (entryState) {
|
293
|
+
return entryState.config;
|
294
|
+
});
|
295
|
+
}
|
296
|
+
function useEntryStateCollectionItem(collectionName, key) {
|
297
|
+
return useEntryState(function (entryState) {
|
298
|
+
return getItem(entryState.collections, collectionName, key);
|
299
|
+
});
|
300
|
+
}
|
301
|
+
function useEntryStateCollectionItems(collectionName, filter) {
|
302
|
+
var itemsSelector = useMemo(function () {
|
303
|
+
return createItemsSelector(collectionName, filter);
|
304
|
+
}, [collectionName, filter]);
|
305
|
+
return useEntryState(function (entryState) {
|
306
|
+
return itemsSelector(entryState.collections);
|
307
|
+
});
|
308
|
+
}
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Returns a nested data structure representing the metadata of the entry.
|
312
|
+
*
|
313
|
+
* @example
|
314
|
+
*
|
315
|
+
* const metaData = useEntryMetadata();
|
316
|
+
* metaData // =>
|
317
|
+
* {
|
318
|
+
* id: 5,
|
319
|
+
* locale: 'en',
|
320
|
+
* shareProviders: {email: false, facebook: true},
|
321
|
+
* share_url: 'http://test.host/test',
|
322
|
+
* credits: 'Credits: Pageflow'
|
323
|
+
* }
|
324
|
+
*/
|
325
|
+
|
326
|
+
function useEntryMetadata() {
|
327
|
+
var entries = useEntryStateCollectionItems('entries');
|
328
|
+
return useMemo(function () {
|
329
|
+
return entries[0];
|
330
|
+
}, [entries]);
|
331
|
+
}
|
332
|
+
|
333
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
334
|
+
if (source == null) return {};
|
335
|
+
var target = {};
|
336
|
+
var sourceKeys = Object.keys(source);
|
337
|
+
var key, i;
|
338
|
+
|
339
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
340
|
+
key = sourceKeys[i];
|
341
|
+
if (excluded.indexOf(key) >= 0) continue;
|
342
|
+
target[key] = source[key];
|
343
|
+
}
|
344
|
+
|
345
|
+
return target;
|
346
|
+
}
|
347
|
+
|
348
|
+
function _objectWithoutProperties(source, excluded) {
|
349
|
+
if (source == null) return {};
|
350
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
351
|
+
var key, i;
|
352
|
+
|
353
|
+
if (Object.getOwnPropertySymbols) {
|
354
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
355
|
+
|
356
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
357
|
+
key = sourceSymbolKeys[i];
|
358
|
+
if (excluded.indexOf(key) >= 0) continue;
|
359
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
360
|
+
target[key] = source[key];
|
361
|
+
}
|
362
|
+
}
|
363
|
+
|
364
|
+
return target;
|
365
|
+
}
|
366
|
+
|
367
|
+
function _extends() {
|
368
|
+
_extends = Object.assign || function (target) {
|
369
|
+
for (var i = 1; i < arguments.length; i++) {
|
370
|
+
var source = arguments[i];
|
371
|
+
|
372
|
+
for (var key in source) {
|
373
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
374
|
+
target[key] = source[key];
|
375
|
+
}
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
return target;
|
380
|
+
};
|
381
|
+
|
382
|
+
return _extends.apply(this, arguments);
|
383
|
+
}
|
384
|
+
var EmailIcon = (function (_ref) {
|
385
|
+
var _ref$styles = _ref.styles,
|
386
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
387
|
+
|
388
|
+
return React.createElement("svg", _extends({
|
389
|
+
xmlns: "http://www.w3.org/2000/svg",
|
390
|
+
viewBox: "0 0 612 612"
|
391
|
+
}, props), React.createElement("path", {
|
392
|
+
d: "M573.75 57.375H38.25C17.136 57.375 0 74.511 0 95.625v420.75c0 21.133 17.136 38.25 38.25 38.25h535.5c21.133 0 38.25-17.117 38.25-38.25V95.625c0-21.114-17.117-38.25-38.25-38.25zM554.625 497.25H57.375V204.657l224.03 187.999c7.134 5.967 15.874 8.97 24.595 8.97 8.74 0 17.461-3.003 24.595-8.97l224.03-187.999V497.25zm0-367.487L306 338.379 57.375 129.763V114.75h497.25v15.013z"
|
393
|
+
}));
|
394
|
+
});
|
395
|
+
|
396
|
+
function _extends$1() {
|
397
|
+
_extends$1 = Object.assign || function (target) {
|
398
|
+
for (var i = 1; i < arguments.length; i++) {
|
399
|
+
var source = arguments[i];
|
400
|
+
|
401
|
+
for (var key in source) {
|
402
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
403
|
+
target[key] = source[key];
|
404
|
+
}
|
405
|
+
}
|
406
|
+
}
|
407
|
+
|
408
|
+
return target;
|
409
|
+
};
|
410
|
+
|
411
|
+
return _extends$1.apply(this, arguments);
|
412
|
+
}
|
413
|
+
var FacebookIcon = (function (_ref) {
|
414
|
+
var _ref$styles = _ref.styles,
|
415
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
416
|
+
|
417
|
+
return React.createElement("svg", _extends$1({
|
418
|
+
xmlns: "http://www.w3.org/2000/svg",
|
419
|
+
viewBox: "0 0 430.113 430.114"
|
420
|
+
}, props), React.createElement("path", {
|
421
|
+
d: "M158.081 83.3v59.218h-43.385v72.412h43.385v215.183h89.122V214.936h59.805s5.601-34.721 8.316-72.685H247.54V92.74c0-7.4 9.717-17.354 19.321-17.354h48.557V.001h-66.021C155.878-.004 158.081 72.48 158.081 83.3z"
|
422
|
+
}));
|
423
|
+
});
|
424
|
+
|
425
|
+
function _extends$2() {
|
426
|
+
_extends$2 = Object.assign || function (target) {
|
427
|
+
for (var i = 1; i < arguments.length; i++) {
|
428
|
+
var source = arguments[i];
|
429
|
+
|
430
|
+
for (var key in source) {
|
431
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
432
|
+
target[key] = source[key];
|
433
|
+
}
|
434
|
+
}
|
435
|
+
}
|
436
|
+
|
437
|
+
return target;
|
438
|
+
};
|
439
|
+
|
440
|
+
return _extends$2.apply(this, arguments);
|
441
|
+
}
|
442
|
+
var LinkedInIcon = (function (_ref) {
|
443
|
+
var _ref$styles = _ref.styles,
|
444
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
445
|
+
|
446
|
+
return React.createElement("svg", _extends$2({
|
447
|
+
xmlns: "http://www.w3.org/2000/svg",
|
448
|
+
viewBox: "0 0 430.117 430.117"
|
449
|
+
}, props), React.createElement("path", {
|
450
|
+
d: "M430.117 261.543V420.56h-92.188V272.193c0-37.271-13.334-62.707-46.703-62.707-25.473 0-40.632 17.142-47.301 33.724-2.432 5.928-3.058 14.179-3.058 22.477V420.56h-92.219s1.242-251.285 0-277.32h92.21v39.309c-.187.294-.43.611-.606.896h.606v-.896c12.251-18.869 34.13-45.824 83.102-45.824 60.673-.001 106.157 39.636 106.157 124.818zM52.183 9.558C20.635 9.558 0 30.251 0 57.463c0 26.619 20.038 47.94 50.959 47.94h.616c32.159 0 52.159-21.317 52.159-47.94-.606-27.212-20-47.905-51.551-47.905zM5.477 420.56h92.184V143.24H5.477v277.32z"
|
451
|
+
}));
|
452
|
+
});
|
453
|
+
|
454
|
+
function _extends$3() {
|
455
|
+
_extends$3 = Object.assign || function (target) {
|
456
|
+
for (var i = 1; i < arguments.length; i++) {
|
457
|
+
var source = arguments[i];
|
458
|
+
|
459
|
+
for (var key in source) {
|
460
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
461
|
+
target[key] = source[key];
|
462
|
+
}
|
463
|
+
}
|
464
|
+
}
|
465
|
+
|
466
|
+
return target;
|
467
|
+
};
|
468
|
+
|
469
|
+
return _extends$3.apply(this, arguments);
|
470
|
+
}
|
471
|
+
var TelegramIcon = (function (_ref) {
|
472
|
+
var _ref$styles = _ref.styles,
|
473
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
474
|
+
|
475
|
+
return React.createElement("svg", _extends$3({
|
476
|
+
xmlns: "http://www.w3.org/2000/svg",
|
477
|
+
viewBox: "0 0 512.004 512.004"
|
478
|
+
}, props), React.createElement("path", {
|
479
|
+
d: "M508.194 20.517c-4.43-4.96-11.42-6.29-17.21-3.76l-482 211a15.01 15.01 0 00-8.98 13.41 15.005 15.005 0 008.38 13.79l115.09 56.6 28.68 172.06c.93 6.53 6.06 11.78 12.74 12.73 4.8.69 9.57-1 12.87-4.4l90.86-90.86 129.66 92.62a15.02 15.02 0 0014.24 1.74 15.01 15.01 0 009.19-11.01l90-451c.89-4.47-.26-9.26-3.52-12.92zm-372.84 263.45l-84.75-41.68 334.82-146.57-250.07 188.25zm46.94 44.59l-13.95 69.75-15.05-90.3 183.97-138.49-150.88 151.39c-2.12 2.12-3.53 4.88-4.09 7.65zm9.13 107.3l15.74-78.67 36.71 26.22-52.45 52.45zm205.41 19.94l-176.73-126.23 252.47-253.31-75.74 379.54z"
|
480
|
+
}));
|
481
|
+
});
|
482
|
+
|
483
|
+
function _extends$4() {
|
484
|
+
_extends$4 = Object.assign || function (target) {
|
485
|
+
for (var i = 1; i < arguments.length; i++) {
|
486
|
+
var source = arguments[i];
|
487
|
+
|
488
|
+
for (var key in source) {
|
489
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
490
|
+
target[key] = source[key];
|
491
|
+
}
|
492
|
+
}
|
493
|
+
}
|
494
|
+
|
495
|
+
return target;
|
496
|
+
};
|
497
|
+
|
498
|
+
return _extends$4.apply(this, arguments);
|
499
|
+
}
|
500
|
+
var TwitterIcon = (function (_ref) {
|
501
|
+
var _ref$styles = _ref.styles,
|
502
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
503
|
+
|
504
|
+
return React.createElement("svg", _extends$4({
|
505
|
+
xmlns: "http://www.w3.org/2000/svg",
|
506
|
+
viewBox: "0 0 612 612"
|
507
|
+
}, props), React.createElement("path", {
|
508
|
+
d: "M612 116.258a250.714 250.714 0 01-72.088 19.772c25.929-15.527 45.777-40.155 55.184-69.411-24.322 14.379-51.169 24.82-79.775 30.48-22.907-24.437-55.49-39.658-91.63-39.658-69.334 0-125.551 56.217-125.551 125.513 0 9.828 1.109 19.427 3.251 28.606-104.326-5.24-196.835-55.223-258.75-131.174-10.823 18.51-16.98 40.078-16.98 63.101 0 43.559 22.181 81.993 55.835 104.479a125.556 125.556 0 01-56.867-15.756v1.568c0 60.806 43.291 111.554 100.693 123.104-10.517 2.83-21.607 4.398-33.08 4.398-8.107 0-15.947-.803-23.634-2.333 15.985 49.907 62.336 86.199 117.253 87.194-42.947 33.654-97.099 53.655-155.916 53.655-10.134 0-20.116-.612-29.944-1.721 55.567 35.681 121.536 56.485 192.438 56.485 230.948 0 357.188-191.291 357.188-357.188l-.421-16.253c24.666-17.593 46.005-39.697 62.794-64.861z"
|
509
|
+
}));
|
510
|
+
});
|
511
|
+
|
512
|
+
function _extends$5() {
|
513
|
+
_extends$5 = Object.assign || function (target) {
|
514
|
+
for (var i = 1; i < arguments.length; i++) {
|
515
|
+
var source = arguments[i];
|
516
|
+
|
517
|
+
for (var key in source) {
|
518
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
519
|
+
target[key] = source[key];
|
520
|
+
}
|
521
|
+
}
|
522
|
+
}
|
523
|
+
|
524
|
+
return target;
|
525
|
+
};
|
526
|
+
|
527
|
+
return _extends$5.apply(this, arguments);
|
528
|
+
}
|
529
|
+
var WhatsAppIcon = (function (_ref) {
|
530
|
+
var _ref$styles = _ref.styles,
|
531
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
532
|
+
|
533
|
+
return React.createElement("svg", _extends$5({
|
534
|
+
xmlns: "http://www.w3.org/2000/svg",
|
535
|
+
viewBox: "0 0 90 90"
|
536
|
+
}, props), React.createElement("path", {
|
537
|
+
d: "M90 43.841c0 24.213-19.779 43.841-44.182 43.841a44.256 44.256 0 01-21.357-5.455L0 90l7.975-23.522a43.38 43.38 0 01-6.34-22.637C1.635 19.628 21.416 0 45.818 0 70.223 0 90 19.628 90 43.841zM45.818 6.982c-20.484 0-37.146 16.535-37.146 36.859 0 8.065 2.629 15.534 7.076 21.61L11.107 79.14l14.275-4.537A37.122 37.122 0 0045.819 80.7c20.481 0 37.146-16.533 37.146-36.857S66.301 6.982 45.818 6.982zm22.311 46.956c-.273-.447-.994-.717-2.076-1.254-1.084-.537-6.41-3.138-7.4-3.495-.993-.358-1.717-.538-2.438.537-.721 1.076-2.797 3.495-3.43 4.212-.632.719-1.263.809-2.347.271-1.082-.537-4.571-1.673-8.708-5.333-3.219-2.848-5.393-6.364-6.025-7.441-.631-1.075-.066-1.656.475-2.191.488-.482 1.084-1.255 1.625-1.882.543-.628.723-1.075 1.082-1.793.363-.717.182-1.344-.09-1.883-.27-.537-2.438-5.825-3.34-7.977-.902-2.15-1.803-1.792-2.436-1.792-.631 0-1.354-.09-2.076-.09s-1.896.269-2.889 1.344c-.992 1.076-3.789 3.676-3.789 8.963 0 5.288 3.879 10.397 4.422 11.113.541.716 7.49 11.92 18.5 16.223C58.2 65.771 58.2 64.336 60.186 64.156c1.984-.179 6.406-2.599 7.312-5.107.9-2.512.9-4.663.631-5.111z"
|
538
|
+
}));
|
539
|
+
});
|
540
|
+
|
541
|
+
/**
|
542
|
+
* Returns a list of attributes (icon, name and url) of all configured share providers of the entry.
|
543
|
+
* The url provides a %{url} placeholder where the link can be inserted.
|
544
|
+
*
|
545
|
+
* @example
|
546
|
+
*
|
547
|
+
* const shareProviders = useShareProviders(options);
|
548
|
+
* shareProviders // =>
|
549
|
+
* [
|
550
|
+
* {
|
551
|
+
* icon: <FacebookSVGIcon />,
|
552
|
+
* name: 'Facebook',
|
553
|
+
* url: http://www.facebook.com/sharer/sharer.php?u=%{url}
|
554
|
+
* },
|
555
|
+
* {
|
556
|
+
* icon: <TwitterSVGIcon />,
|
557
|
+
* name: 'Twitter',
|
558
|
+
* url: https://twitter.com/intent/tweet?url=%{url}
|
559
|
+
* }
|
560
|
+
* ]
|
561
|
+
*/
|
562
|
+
|
563
|
+
function useShareProviders(_ref) {
|
564
|
+
var isPhonePlatform = _ref.isPhonePlatform;
|
565
|
+
var config = useEntryStateConfig();
|
566
|
+
var entryMetadata = useEntryMetadata();
|
567
|
+
var shareProviders = entryMetadata ? entryMetadata.shareProviders : {};
|
568
|
+
var urlTemplates = config.shareUrlTemplates;
|
569
|
+
var sharing = {
|
570
|
+
email: {
|
571
|
+
icon: EmailIcon,
|
572
|
+
name: 'Mail',
|
573
|
+
url: urlTemplates.email
|
574
|
+
},
|
575
|
+
facebook: {
|
576
|
+
icon: FacebookIcon,
|
577
|
+
name: 'Facebook',
|
578
|
+
url: urlTemplates.facebook
|
579
|
+
},
|
580
|
+
linked_in: {
|
581
|
+
icon: LinkedInIcon,
|
582
|
+
name: 'LinkedIn',
|
583
|
+
url: urlTemplates.linked_in
|
584
|
+
},
|
585
|
+
telegram: {
|
586
|
+
icon: TelegramIcon,
|
587
|
+
name: 'Telegram',
|
588
|
+
url: urlTemplates.telegram
|
589
|
+
},
|
590
|
+
twitter: {
|
591
|
+
icon: TwitterIcon,
|
592
|
+
name: 'Twitter',
|
593
|
+
url: urlTemplates.twitter
|
594
|
+
},
|
595
|
+
whats_app: {
|
596
|
+
icon: WhatsAppIcon,
|
597
|
+
name: 'WhatsApp',
|
598
|
+
url: urlTemplates.whats_app
|
599
|
+
}
|
600
|
+
};
|
601
|
+
return useMemo(function () {
|
602
|
+
return activeShareProviders(shareProviders, isPhonePlatform).map(function (provider) {
|
603
|
+
var config = sharing[provider];
|
604
|
+
return {
|
605
|
+
name: config.name,
|
606
|
+
icon: config.icon,
|
607
|
+
url: config.url
|
608
|
+
};
|
609
|
+
});
|
610
|
+
}, [shareProviders, isPhonePlatform]);
|
611
|
+
}
|
612
|
+
|
613
|
+
function activeShareProviders(shareProvidersConfig, isPhonePlatform) {
|
614
|
+
var providers = filterShareProviders(shareProvidersConfig, isPhonePlatform);
|
615
|
+
return providers.filter(function (provider) {
|
616
|
+
return shareProvidersConfig[provider] !== false;
|
617
|
+
});
|
618
|
+
}
|
619
|
+
|
620
|
+
function filterShareProviders(shareProvidersConfig, isPhonePlatform) {
|
621
|
+
if (!isPhonePlatform) {
|
622
|
+
return Object.keys(shareProvidersConfig).filter(function (provider) {
|
623
|
+
return provider !== 'telegram' && provider !== 'whats_app';
|
624
|
+
});
|
625
|
+
}
|
626
|
+
|
627
|
+
return Object.keys(shareProvidersConfig);
|
628
|
+
}
|
629
|
+
/**
|
630
|
+
* Returns the share url of the entry.
|
631
|
+
*
|
632
|
+
* @example
|
633
|
+
*
|
634
|
+
* const shareUrl = useShareUrl();
|
635
|
+
* shareUrl // => "http://test.host/test"
|
636
|
+
*/
|
637
|
+
|
638
|
+
|
639
|
+
function useShareUrl() {
|
640
|
+
var entryMetadata = useEntryMetadata();
|
641
|
+
var config = useEntryStateConfig();
|
642
|
+
|
643
|
+
if (entryMetadata) {
|
644
|
+
return entryMetadata.shareUrl ? entryMetadata.shareUrl : config.prettyUrl;
|
645
|
+
} else {
|
646
|
+
return config.shareUrl;
|
647
|
+
}
|
648
|
+
}
|
649
|
+
|
650
|
+
/**
|
651
|
+
* Returns a nested data structure representing the chapters, sections
|
652
|
+
* and content elements of the entry.
|
653
|
+
*
|
654
|
+
* @private
|
655
|
+
*
|
656
|
+
* @example
|
657
|
+
*
|
658
|
+
* const structure = useEntryStructure();
|
659
|
+
* structure // =>
|
660
|
+
* [
|
661
|
+
* {
|
662
|
+
* permaId: 5,
|
663
|
+
* title: 'Chapter 1',
|
664
|
+
* summary: 'An introductory chapter',
|
665
|
+
* sections: [
|
666
|
+
* {
|
667
|
+
* id: 1,
|
668
|
+
* permaId: 101,
|
669
|
+
* chapterId: 3,
|
670
|
+
* sectionIndex: 0,
|
671
|
+
* transition: 'scroll',
|
672
|
+
*
|
673
|
+
* // references to adjacent section objects
|
674
|
+
* previousSection: { ... },
|
675
|
+
* nextSection: { ... },
|
676
|
+
* }
|
677
|
+
* ],
|
678
|
+
* }
|
679
|
+
* ]
|
680
|
+
*/
|
681
|
+
|
682
|
+
function useEntryStructure() {
|
683
|
+
var chapters = useChapters();
|
684
|
+
var sections = useEntryStateCollectionItems('sections');
|
685
|
+
return useMemo(function () {
|
686
|
+
var linkedSections = sections.map(function (section) {
|
687
|
+
return sectionData(section);
|
688
|
+
});
|
689
|
+
linkedSections.forEach(function (section, index) {
|
690
|
+
section.sectionIndex = index;
|
691
|
+
section.previousSection = linkedSections[index - 1];
|
692
|
+
section.nextSection = linkedSections[index + 1];
|
693
|
+
});
|
694
|
+
return chapters.map(function (chapter) {
|
695
|
+
return _objectSpread2(_objectSpread2({}, chapter), {}, {
|
696
|
+
sections: linkedSections.filter(function (item) {
|
697
|
+
return item.chapterId === chapter.id;
|
698
|
+
})
|
699
|
+
});
|
700
|
+
});
|
701
|
+
}, [chapters, sections]);
|
702
|
+
}
|
703
|
+
/**
|
704
|
+
* Returns a nested data structure representing the content elements
|
705
|
+
* of section.
|
706
|
+
*
|
707
|
+
* @param {Object} options
|
708
|
+
* @param {number} options.sectionPermaId
|
709
|
+
*
|
710
|
+
* @private
|
711
|
+
*
|
712
|
+
* @example
|
713
|
+
*
|
714
|
+
* const section = useSection({sectionPermaId: 4});
|
715
|
+
* section // =>
|
716
|
+
* {
|
717
|
+
* id: 100,
|
718
|
+
* permaId: 4,
|
719
|
+
* chapterId: 1,
|
720
|
+
* transition: 'scroll'
|
721
|
+
* }
|
722
|
+
*/
|
723
|
+
|
724
|
+
function useSection(_ref) {
|
725
|
+
var sectionPermaId = _ref.sectionPermaId;
|
726
|
+
var section = useEntryStateCollectionItem('sections', sectionPermaId);
|
727
|
+
return sectionData(section);
|
728
|
+
}
|
729
|
+
|
730
|
+
function sectionData(section) {
|
731
|
+
return section && _objectSpread2({
|
732
|
+
permaId: section.permaId,
|
733
|
+
id: section.id,
|
734
|
+
chapterId: section.chapterId
|
735
|
+
}, section.configuration);
|
736
|
+
}
|
737
|
+
|
738
|
+
function useSectionContentElements(_ref2) {
|
739
|
+
var sectionId = _ref2.sectionId;
|
740
|
+
var filterBySectionId = useCallback(function (contentElement) {
|
741
|
+
return contentElement.sectionId === sectionId;
|
742
|
+
}, [sectionId]);
|
743
|
+
var contentElements = useEntryStateCollectionItems('contentElements', filterBySectionId);
|
744
|
+
return contentElements.map(function (item) {
|
745
|
+
return {
|
746
|
+
id: item.id,
|
747
|
+
permaId: item.permaId,
|
748
|
+
type: item.typeName,
|
749
|
+
position: item.configuration.position,
|
750
|
+
props: item.configuration
|
751
|
+
};
|
752
|
+
});
|
753
|
+
}
|
754
|
+
function useChapters() {
|
755
|
+
var chapters = useEntryStateCollectionItems('chapters');
|
756
|
+
var chapterSlugs = {};
|
757
|
+
return chapters.map(function (chapter) {
|
758
|
+
var chapterSlug = chapter.configuration.title;
|
759
|
+
|
760
|
+
if (chapterSlug) {
|
761
|
+
chapterSlug = slugify(chapterSlug, {
|
762
|
+
lower: true,
|
763
|
+
locale: 'de',
|
764
|
+
strict: true
|
765
|
+
});
|
766
|
+
|
767
|
+
if (chapterSlugs[chapterSlug]) {
|
768
|
+
chapterSlug = chapterSlug + '-' + chapter.permaId; //append permaId if chapter reference is not unique
|
769
|
+
}
|
770
|
+
|
771
|
+
chapterSlugs[chapterSlug] = chapter;
|
772
|
+
} else {
|
773
|
+
chapterSlug = 'chapter-' + chapter.permaId;
|
774
|
+
}
|
775
|
+
|
776
|
+
return {
|
777
|
+
id: chapter.id,
|
778
|
+
permaId: chapter.permaId,
|
779
|
+
title: chapter.configuration.title,
|
780
|
+
summary: chapter.configuration.summary,
|
781
|
+
chapterSlug: chapterSlug
|
782
|
+
};
|
783
|
+
});
|
784
|
+
}
|
785
|
+
|
786
|
+
function extendFile(collectionName, file, config) {
|
787
|
+
return addModelType(collectionName, expandUrls(collectionName, file, config.fileUrlTemplates), config.fileModelTypes);
|
788
|
+
}
|
789
|
+
|
790
|
+
function addModelType(collectionName, file, modelTypes) {
|
791
|
+
if (!file) {
|
792
|
+
return null;
|
793
|
+
}
|
794
|
+
|
795
|
+
if (!modelTypes[collectionName]) {
|
796
|
+
throw new Error("Could not find model type for collection name ".concat(collectionName));
|
797
|
+
}
|
798
|
+
|
799
|
+
return _objectSpread2(_objectSpread2({}, file), {}, {
|
800
|
+
modelType: modelTypes[collectionName]
|
801
|
+
});
|
802
|
+
}
|
803
|
+
|
804
|
+
function expandUrls(collectionName, file, urlTemplates) {
|
805
|
+
if (!file) {
|
806
|
+
return null;
|
807
|
+
}
|
808
|
+
|
809
|
+
if (!urlTemplates[collectionName]) {
|
810
|
+
throw new Error("No file url templates found for ".concat(collectionName));
|
811
|
+
}
|
812
|
+
|
813
|
+
var variants = file.variants || Object.keys(urlTemplates[collectionName]);
|
814
|
+
var urls = variants.reduce(function (result, variant) {
|
815
|
+
var url = getFileUrl(collectionName, file, variant, urlTemplates);
|
816
|
+
|
817
|
+
if (url) {
|
818
|
+
result[variant] = url;
|
819
|
+
}
|
820
|
+
|
821
|
+
return result;
|
822
|
+
}, {});
|
823
|
+
return _objectSpread2({
|
824
|
+
urls: urls
|
825
|
+
}, file);
|
826
|
+
}
|
827
|
+
|
828
|
+
function getFileUrl(collectionName, file, quality, urlTemplates) {
|
829
|
+
var templates = urlTemplates[collectionName];
|
830
|
+
var template = templates[quality];
|
831
|
+
|
832
|
+
if (template) {
|
833
|
+
return template.replace(':id_partition', idPartition(file.id)).replace(':basename', file.basename);
|
834
|
+
}
|
835
|
+
}
|
836
|
+
|
837
|
+
function idPartition(id) {
|
838
|
+
return partition(pad(id, 9));
|
839
|
+
}
|
840
|
+
|
841
|
+
function partition(string, separator) {
|
842
|
+
return string.replace(/./g, function (c, i, a) {
|
843
|
+
return i && (a.length - i) % 3 === 0 ? '/' + c : c;
|
844
|
+
});
|
845
|
+
}
|
846
|
+
|
847
|
+
function pad(string, size) {
|
848
|
+
return (Array(size).fill(0).join('') + string).slice(-size);
|
849
|
+
}
|
850
|
+
|
851
|
+
/**
|
852
|
+
* Look up a file by its collection and perma id.
|
853
|
+
*
|
854
|
+
* @param {Object} options
|
855
|
+
* @param {String} options.collectionName - Collection name of file type to look for (in camel case).
|
856
|
+
* @param {String} options.permaId - Perma id of file look up
|
857
|
+
*
|
858
|
+
* @example
|
859
|
+
* const imageFile = useFile({collectionName: 'imageFiles', permaId: 5});
|
860
|
+
* imageFile // =>
|
861
|
+
* {
|
862
|
+
* id: 102,
|
863
|
+
* permaId: 5,
|
864
|
+
* width: 1000,
|
865
|
+
* height: 500,
|
866
|
+
* urls: {
|
867
|
+
* large: 'https://...'
|
868
|
+
* },
|
869
|
+
* configuration: {
|
870
|
+
* alt: '...'
|
871
|
+
* }
|
872
|
+
* }
|
873
|
+
*/
|
874
|
+
|
875
|
+
function useFile(_ref) {
|
876
|
+
var collectionName = _ref.collectionName,
|
877
|
+
permaId = _ref.permaId;
|
878
|
+
var file = useEntryStateCollectionItem(collectionName, permaId);
|
879
|
+
return extendFile(collectionName, file, useEntryStateConfig());
|
880
|
+
}
|
881
|
+
|
882
|
+
function useNestedFiles(_ref) {
|
883
|
+
var collectionName = _ref.collectionName,
|
884
|
+
parent = _ref.parent;
|
885
|
+
var config = useEntryStateConfig();
|
886
|
+
var files = useEntryStateCollectionItems(collectionName, function (file) {
|
887
|
+
return parent && file.parentFileId === parent.id && file.parentFileModelType === parent.modelType;
|
888
|
+
});
|
889
|
+
return files.map(function (file) {
|
890
|
+
return extendFile(collectionName, file, config);
|
891
|
+
});
|
892
|
+
}
|
893
|
+
|
894
|
+
/**
|
895
|
+
* Returns a string (comma-separated list) of copyrights of
|
896
|
+
* all images used in the entry.
|
897
|
+
* If none of the images has a rights attribute configured,
|
898
|
+
* it falls back to the default file rights of the entry's account,
|
899
|
+
* otherwise returns an empty string
|
900
|
+
*
|
901
|
+
* @example
|
902
|
+
*
|
903
|
+
* const fileRights = useFileRights();
|
904
|
+
* fileRights // => "author of image 1, author of image 2"
|
905
|
+
*/
|
906
|
+
|
907
|
+
function useFileRights() {
|
908
|
+
var _config$defaultFileRi;
|
909
|
+
|
910
|
+
var config = useEntryStateConfig();
|
911
|
+
var imageFiles = useEntryStateCollectionItems('imageFiles');
|
912
|
+
var defaultFileRights = (_config$defaultFileRi = config.defaultFileRights) === null || _config$defaultFileRi === void 0 ? void 0 : _config$defaultFileRi.trim();
|
913
|
+
return Array.from(new Set(imageFiles.map(function (imageFile) {
|
914
|
+
var _imageFile$rights;
|
915
|
+
|
916
|
+
return ((_imageFile$rights = imageFile.rights) === null || _imageFile$rights === void 0 ? void 0 : _imageFile$rights.trim()) || defaultFileRights;
|
917
|
+
}))).filter(Boolean).join(', ');
|
918
|
+
}
|
919
|
+
/**
|
920
|
+
* Returns a nested data structure representing the legal info of the entry.
|
921
|
+
* Each legal info is separated into label and url to use in links.
|
922
|
+
* Both label and url can be blank, depending on the configuration.
|
923
|
+
*
|
924
|
+
* @example
|
925
|
+
*
|
926
|
+
* const legalInfo = useLegalInfo();
|
927
|
+
* legalInfo // =>
|
928
|
+
* {
|
929
|
+
* imprint: {
|
930
|
+
* label: '',
|
931
|
+
* url: ''
|
932
|
+
* },
|
933
|
+
* copyright: {
|
934
|
+
* label: '',
|
935
|
+
* url: ''
|
936
|
+
* },
|
937
|
+
* privacy: {
|
938
|
+
* label: '',
|
939
|
+
* url: ''
|
940
|
+
* }
|
941
|
+
* }
|
942
|
+
*/
|
943
|
+
|
944
|
+
function useLegalInfo() {
|
945
|
+
var config = useEntryStateConfig();
|
946
|
+
return config.legalInfo;
|
947
|
+
}
|
948
|
+
/**
|
949
|
+
* Returns the credits string (rich text) of the entry.
|
950
|
+
*
|
951
|
+
* @example
|
952
|
+
*
|
953
|
+
* const credits = useCredits();
|
954
|
+
* credits // => "Credits: <a href="http://pageflow.com">pageflow.com</a>"
|
955
|
+
*/
|
956
|
+
|
957
|
+
function useCredits() {
|
958
|
+
var entryMetadata = useEntryMetadata();
|
959
|
+
var credits = '';
|
960
|
+
|
961
|
+
if (entryMetadata) {
|
962
|
+
credits = entryMetadata.credits;
|
963
|
+
}
|
964
|
+
|
965
|
+
return credits;
|
966
|
+
}
|
967
|
+
|
968
|
+
function _arrayWithoutHoles(arr) {
|
969
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
970
|
+
}
|
971
|
+
|
972
|
+
function _iterableToArray(iter) {
|
973
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
974
|
+
}
|
975
|
+
|
976
|
+
function _nonIterableSpread() {
|
977
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
978
|
+
}
|
979
|
+
|
980
|
+
function _toConsumableArray(arr) {
|
981
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
982
|
+
}
|
983
|
+
|
984
|
+
var qualities = ['medium', 'fullhd', '4k'];
|
985
|
+
function useAvailableQualities(file) {
|
986
|
+
if (!file) {
|
987
|
+
return [];
|
988
|
+
}
|
989
|
+
|
990
|
+
return ['auto'].concat(_toConsumableArray(qualities.filter(function (name) {
|
991
|
+
return file.variants.includes(name);
|
992
|
+
})));
|
993
|
+
}
|
994
|
+
|
995
|
+
/**
|
996
|
+
* Returns an object containing theme asset paths.
|
997
|
+
*
|
998
|
+
* @example
|
999
|
+
*
|
1000
|
+
* const theme = useTheme();
|
1001
|
+
* theme // =>
|
1002
|
+
* {
|
1003
|
+
* assets: {
|
1004
|
+
* logoDesktop: 'path/to/logoDesktop.svg',
|
1005
|
+
* logoMobile: 'path/to/logoMobile.svg'
|
1006
|
+
* },
|
1007
|
+
* options: {
|
1008
|
+
* // options passed to `themes.register` in `pageflow.rb` initializer
|
1009
|
+
* // with camleized keys.
|
1010
|
+
* }
|
1011
|
+
* }
|
1012
|
+
*/
|
1013
|
+
|
1014
|
+
function useTheme() {
|
1015
|
+
var config = useEntryStateConfig();
|
1016
|
+
return config.theme;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
function updateContentElementConfiguration(_ref) {
|
1020
|
+
var dispatch = _ref.dispatch,
|
1021
|
+
permaId = _ref.permaId,
|
1022
|
+
configuration = _ref.configuration;
|
1023
|
+
updateConfiguration({
|
1024
|
+
dispatch: dispatch,
|
1025
|
+
name: 'contentElements',
|
1026
|
+
key: permaId,
|
1027
|
+
configuration: configuration
|
1028
|
+
});
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
var LocaleContext = createContext$1('en');
|
1032
|
+
function setupI18n(_ref) {
|
1033
|
+
var defaultLocale = _ref.defaultLocale,
|
1034
|
+
locale = _ref.locale,
|
1035
|
+
translations = _ref.translations;
|
1036
|
+
I18n.defaultLocale = defaultLocale;
|
1037
|
+
I18n.locale = locale;
|
1038
|
+
I18n.translations = translations;
|
1039
|
+
}
|
1040
|
+
function LocaleProvider(_ref2) {
|
1041
|
+
var children = _ref2.children;
|
1042
|
+
|
1043
|
+
var _ref3 = useEntryMetadata() || {},
|
1044
|
+
locale = _ref3.locale;
|
1045
|
+
|
1046
|
+
return (
|
1047
|
+
/*#__PURE__*/
|
1048
|
+
React.createElement(LocaleContext.Provider, {
|
1049
|
+
value: locale
|
1050
|
+
}, children)
|
1051
|
+
);
|
1052
|
+
}
|
1053
|
+
function useLocale() {
|
1054
|
+
return useContext(LocaleContext);
|
1055
|
+
}
|
1056
|
+
/**
|
1057
|
+
* Use translations in frontend elements. Uses the configured locale
|
1058
|
+
* of the current entry by default. Note that only translation keys
|
1059
|
+
* from the `pageflow_scrolled.public` scope are universally
|
1060
|
+
* available.
|
1061
|
+
*
|
1062
|
+
* to render translations for inline editing controls in the editor
|
1063
|
+
* preview, you can pass `"ui"` as `locale` option and use
|
1064
|
+
* translations from the `pageflow_scrolled.inline_editing` scope.
|
1065
|
+
*
|
1066
|
+
* @param {Object} [options]
|
1067
|
+
* @param {string} [locale="entry"] -
|
1068
|
+
* Pass `"ui"` to use the locale of the editor interface instead.
|
1069
|
+
*
|
1070
|
+
* @example
|
1071
|
+
* const {t} = useI18n();
|
1072
|
+
* t('pageflow_scrolled.public.some.key')
|
1073
|
+
*
|
1074
|
+
* const {t} = useI18n({locale: 'ui'});
|
1075
|
+
* t('pageflow_scrolled.inline_editing.some.key')
|
1076
|
+
*/
|
1077
|
+
|
1078
|
+
function useI18n() {
|
1079
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
1080
|
+
scope = _ref4.locale;
|
1081
|
+
|
1082
|
+
var locale = useLocale();
|
1083
|
+
return {
|
1084
|
+
t: function t(key, options) {
|
1085
|
+
return I18n.t(key, _objectSpread2(_objectSpread2({}, options), {}, {
|
1086
|
+
locale: scope !== 'ui' && locale
|
1087
|
+
}));
|
1088
|
+
}
|
1089
|
+
};
|
1090
|
+
}
|
1091
|
+
|
1092
|
+
export { EntryStateProvider as E, LocaleProvider as L, _slicedToArray as _, _defineProperty as a, _objectWithoutProperties as b, useFileRights as c, useLegalInfo as d, useCredits as e, useShareProviders as f, useShareUrl as g, useTheme as h, useChapters as i, useEntryStructure as j, _objectSpread2 as k, useEntryMetadata as l, useNestedFiles as m, useFile as n, useSectionContentElements as o, _toConsumableArray as p, useAvailableQualities as q, useEntryStateDispatch as r, useSection as s, setupI18n as t, useI18n as u, useLocale as v, updateContentElementConfiguration as w };
|