@gem-sdk/pages 1.56.0 → 1.57.0-dev.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/components/builder/Body.js +38 -0
  2. package/dist/cjs/components/builder/Footer.js +2 -2
  3. package/dist/cjs/components/builder/Header.js +4 -1
  4. package/dist/cjs/components/builder/InteractionSelectOnPageHeader.js +191 -0
  5. package/dist/cjs/components/builder/SwitchView.js +1 -0
  6. package/dist/cjs/components/builder/Toolbar.js +130 -340
  7. package/dist/cjs/components/builder/Toolbox.js +48 -1
  8. package/dist/cjs/components/builder/toolbar/const.js +7 -0
  9. package/dist/cjs/components/builder/toolbar/utils/findDOMClosest.js +41 -0
  10. package/dist/cjs/components/builder/toolbar/utils/findOverflowParent.js +20 -0
  11. package/dist/cjs/components/builder/toolbar/utils/getChildrenByAttrSelector.js +18 -0
  12. package/dist/cjs/components/builder/toolbar/utils/getDOMElementParents.js +32 -0
  13. package/dist/cjs/components/builder/toolbar/utils/isOverParent.js +16 -0
  14. package/dist/cjs/components/builder/toolbar/utils/isOverToolbarPosition.js +12 -0
  15. package/dist/cjs/components/builder/toolbar/utils/isSection.js +8 -0
  16. package/dist/cjs/components/builder/toolbar/utils/notVisible.js +8 -0
  17. package/dist/cjs/components/builder/toolbar/utils/waitForElementToExist.js +27 -0
  18. package/dist/cjs/components/image-to-layout/DropElement.js +2 -0
  19. package/dist/cjs/libs/api/get-static-page-props-v2.js +2 -1
  20. package/dist/cjs/pages/builder.js +4 -11
  21. package/dist/cjs/pages/static-v2.js +18 -5
  22. package/dist/esm/components/builder/Body.js +34 -0
  23. package/dist/esm/components/builder/Footer.js +2 -2
  24. package/dist/esm/components/builder/Header.js +5 -2
  25. package/dist/esm/components/builder/InteractionSelectOnPageHeader.js +187 -0
  26. package/dist/esm/components/builder/SwitchView.js +1 -0
  27. package/dist/esm/components/builder/Toolbar.js +102 -312
  28. package/dist/esm/components/builder/Toolbox.js +48 -1
  29. package/dist/esm/components/builder/toolbar/const.js +4 -0
  30. package/dist/esm/components/builder/toolbar/utils/findDOMClosest.js +39 -0
  31. package/dist/esm/components/builder/toolbar/utils/findOverflowParent.js +18 -0
  32. package/dist/esm/components/builder/toolbar/utils/getChildrenByAttrSelector.js +16 -0
  33. package/dist/esm/components/builder/toolbar/utils/getDOMElementParents.js +30 -0
  34. package/dist/esm/components/builder/toolbar/utils/isOverParent.js +14 -0
  35. package/dist/esm/components/builder/toolbar/utils/isOverToolbarPosition.js +10 -0
  36. package/dist/esm/components/builder/toolbar/utils/isSection.js +6 -0
  37. package/dist/esm/components/builder/toolbar/utils/notVisible.js +6 -0
  38. package/dist/esm/components/builder/toolbar/utils/waitForElementToExist.js +25 -0
  39. package/dist/esm/components/image-to-layout/DropElement.js +2 -0
  40. package/dist/esm/libs/api/get-static-page-props-v2.js +2 -1
  41. package/dist/esm/pages/builder.js +5 -12
  42. package/dist/esm/pages/static-v2.js +18 -5
  43. package/dist/types/index.d.ts +1 -0
  44. package/package.json +5 -5
  45. package/dist/cjs/components/builder/toolbar/Onboarding.js +0 -110
  46. package/dist/esm/components/builder/toolbar/Onboarding.js +0 -106
@@ -33,6 +33,11 @@ const Toolbox = ()=>{
33
33
  const changeShopPlan = useShopStore((s)=>s.changeShopPlan);
34
34
  const clearModal = useModalStore((s)=>s.clearModal);
35
35
  const changeLimitCreateThemeSection = useShopStore((s)=>s.changeLimitCreateThemeSection);
36
+ const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
37
+ const setInteractionItem = usePageStore((s)=>s.setInteractionItem);
38
+ const setInteractionSelectType = usePageStore((s)=>s.setInteractionSelectType);
39
+ const setInteractionSettingType = usePageStore((s)=>s.setInteractionSettingType);
40
+ const setSidebarMode = usePageStore((s)=>s.setSidebarMode);
36
41
  const fonts = useMemo(()=>getFontsFromDataBuilder(state), [
37
42
  state
38
43
  ]);
@@ -333,6 +338,37 @@ const Toolbox = ()=>{
333
338
  }, [
334
339
  changeLimitCreateThemeSection
335
340
  ]);
341
+ const onUpdateInteractionIsSelectOnPage = useCallback((e)=>{
342
+ const isSelectOnPage = e.detail.value;
343
+ const mode = e.detail.mode;
344
+ const settingType = e.detail.settingType;
345
+ setInteractionIsSelectOnPage(isSelectOnPage);
346
+ setInteractionSelectType(mode);
347
+ setInteractionSettingType(settingType);
348
+ }, [
349
+ setInteractionIsSelectOnPage,
350
+ setInteractionSelectType,
351
+ setInteractionSettingType
352
+ ]);
353
+ const onUpdateInteractionSettingType = useCallback((e)=>{
354
+ const settingType = e.detail.settingType;
355
+ setInteractionSettingType(settingType);
356
+ }, [
357
+ setInteractionSettingType
358
+ ]);
359
+ const onChangeSidebarMode = useCallback((e)=>{
360
+ const mode = e.detail.mode;
361
+ console.log(mode);
362
+ setSidebarMode(mode);
363
+ }, [
364
+ setSidebarMode
365
+ ]);
366
+ const onUpdateInteractionItem = useCallback((e)=>{
367
+ const interactionItem = e.detail;
368
+ setInteractionItem(interactionItem);
369
+ }, [
370
+ setInteractionItem
371
+ ]);
336
372
  useEffect(()=>{
337
373
  if (fonts) {
338
374
  setFontsToHead('google-font-element', fonts);
@@ -361,6 +397,10 @@ const Toolbox = ()=>{
361
397
  window.addEventListener('set-product-offer', onUpdateProductOffers);
362
398
  window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
363
399
  window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
400
+ window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
401
+ window.addEventListener('update-interaction-item', onUpdateInteractionItem);
402
+ window.addEventListener('update-interaction-setting-type', onUpdateInteractionSettingType);
403
+ window.addEventListener('change-sidebar-mode', onChangeSidebarMode);
364
404
  return ()=>{
365
405
  window.removeEventListener('update-shop-info', onChangeShopInfo);
366
406
  window.removeEventListener('revalidate-query', onRevalidateQuery);
@@ -381,6 +421,9 @@ const Toolbox = ()=>{
381
421
  window.removeEventListener('set-product-offer', onUpdateProductOffers);
382
422
  window.removeEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
383
423
  window.removeEventListener('limit-create-theme-section', onLimitCreateThemeSection);
424
+ window.removeEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
425
+ window.removeEventListener('update-interaction-item', onUpdateInteractionItem);
426
+ window.removeEventListener('update-interaction-setting-type', onUpdateInteractionSettingType);
384
427
  };
385
428
  }, [
386
429
  onAddEntity,
@@ -402,7 +445,11 @@ const Toolbox = ()=>{
402
445
  onUpdateItemAttribute,
403
446
  onUpdateProductOffers,
404
447
  onUpdateSalePageProductId,
405
- onLimitCreateThemeSection
448
+ onLimitCreateThemeSection,
449
+ onUpdateInteractionItem,
450
+ onUpdateInteractionIsSelectOnPage,
451
+ onUpdateInteractionSettingType,
452
+ onChangeSidebarMode
406
453
  ]);
407
454
  return /*#__PURE__*/ jsx("div", {
408
455
  className: "toolbox"
@@ -0,0 +1,4 @@
1
+ const TOOLBAR_HOVER_HEIGHT = 24;
2
+ const TOOLBAR_ACTIVE_HEIGHT = 32;
3
+
4
+ export { TOOLBAR_ACTIVE_HEIGHT, TOOLBAR_HOVER_HEIGHT };
@@ -0,0 +1,39 @@
1
+ const findDOMClosest = ($target, selectors)=>{
2
+ const closestElements = {
3
+ $childrenSlot: null,
4
+ $productFeatureImg: null,
5
+ $section: null,
6
+ $component: null,
7
+ $disableIframeClick: null,
8
+ $stickyMinimize: null,
9
+ $toolbar: null,
10
+ $gpText: null,
11
+ $imageDetection: null,
12
+ $popupTriggerButton: null
13
+ };
14
+ let currentElement = $target;
15
+ while(currentElement){
16
+ // Check for stop conditions
17
+ if (currentElement.matches('[data-uid="ROOT"], .builder, #storefront')) {
18
+ break;
19
+ }
20
+ // Check if currentElement matches any of the selectors
21
+ for (const [key, selector] of Object.entries(selectors)){
22
+ if (!closestElements[key] && currentElement.matches(selector)) {
23
+ closestElements[key] = currentElement;
24
+ }
25
+ }
26
+ // If all closest elements are found, break the loop
27
+ if (Object.values(closestElements).every((el)=>el !== null)) {
28
+ break;
29
+ }
30
+ // Move up to the parent element
31
+ currentElement = currentElement.parentElement;
32
+ }
33
+ // Reset ram
34
+ currentElement = null;
35
+ // Return
36
+ return closestElements;
37
+ };
38
+
39
+ export { findDOMClosest };
@@ -0,0 +1,18 @@
1
+ import { isOverToolbarPosition } from './isOverToolbarPosition.js';
2
+ import { isSection } from './isSection.js';
3
+ import { notVisible } from './notVisible.js';
4
+
5
+ const findOverflowParent = (element, initEl)=>{
6
+ const thisEl = element;
7
+ const origEl = initEl || thisEl;
8
+ if (!thisEl) return;
9
+ if (isSection(thisEl)) return;
10
+ if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
11
+ if (thisEl.parentElement) {
12
+ return findOverflowParent(thisEl.parentElement, origEl);
13
+ } else {
14
+ return;
15
+ }
16
+ };
17
+
18
+ export { findOverflowParent };
@@ -0,0 +1,16 @@
1
+ const getChildrenByAttrSelector = ($el, attrSelector)=>{
2
+ const childLen = $el.children.length;
3
+ if (childLen) {
4
+ for(let i = 0; i < childLen; i++){
5
+ const children = $el.children[i];
6
+ if (children) {
7
+ const is = children.getAttribute(attrSelector);
8
+ if (is) {
9
+ return children;
10
+ }
11
+ }
12
+ }
13
+ }
14
+ };
15
+
16
+ export { getChildrenByAttrSelector };
@@ -0,0 +1,30 @@
1
+ const getDOMElementParents = ($el, selector, limit)=>{
2
+ // Set up a parent array
3
+ const parents = [];
4
+ // Push each parent $elms to the array
5
+ while($el){
6
+ $el = $el.parentElement ?? undefined;
7
+ if ($el) {
8
+ if ($el.tagName === 'BODY' || $el.getAttribute('data-uid') === 'ROOT') {
9
+ break;
10
+ }
11
+ if (selector) {
12
+ if ($el.matches(selector)) {
13
+ parents.push($el);
14
+ if (limit && parents.length == limit) {
15
+ return parents;
16
+ }
17
+ }
18
+ continue;
19
+ }
20
+ parents.push($el);
21
+ if (limit && parents.length == limit) {
22
+ return parents;
23
+ }
24
+ }
25
+ }
26
+ // Return our parent array
27
+ return parents;
28
+ };
29
+
30
+ export { getDOMElementParents };
@@ -0,0 +1,14 @@
1
+ import { TOOLBAR_HOVER_HEIGHT } from '../const.js';
2
+
3
+ const isOverParent = ({ current, parent, index, revert })=>{
4
+ for(let i = 0; i < index; i++){
5
+ let is = current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.top && current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.top + parent.height || current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.top + parent.height && current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.top;
6
+ if (revert) {
7
+ is = current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.bottom && current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.bottom - parent.height || current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.bottom - parent.height && current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.bottom;
8
+ }
9
+ if (is) return true;
10
+ }
11
+ return false;
12
+ };
13
+
14
+ export { isOverParent };
@@ -0,0 +1,10 @@
1
+ import { TOOLBAR_ACTIVE_HEIGHT } from '../const.js';
2
+
3
+ const isOverToolbarPosition = (el, parent)=>{
4
+ const rect = el.getBoundingClientRect();
5
+ const rectP = parent.getBoundingClientRect();
6
+ // 32px = toolbar active height
7
+ return rect.top - rectP.top < TOOLBAR_ACTIVE_HEIGHT + 1;
8
+ };
9
+
10
+ export { isOverToolbarPosition };
@@ -0,0 +1,6 @@
1
+ const isSection = (el)=>{
2
+ const tag = el.getAttribute('data-component-tag');
3
+ return tag === 'Section';
4
+ };
5
+
6
+ export { isSection };
@@ -0,0 +1,6 @@
1
+ const notVisible = (el)=>{
2
+ const overflow = getComputedStyle(el).overflow;
3
+ return overflow !== 'visible';
4
+ };
5
+
6
+ export { notVisible };
@@ -0,0 +1,25 @@
1
+ const waitForElementToExist = (selector, timeout = 200)=>{
2
+ return new Promise((resolve)=>{
3
+ let intervalID = null;
4
+ let timeoutID = null;
5
+ const findEl = ()=>{
6
+ const el = document.body.querySelector('#storefront')?.querySelector(selector);
7
+ if (el) {
8
+ if (intervalID) clearInterval(intervalID);
9
+ if (timeoutID) clearTimeout(timeoutID);
10
+ resolve(el);
11
+ }
12
+ };
13
+ findEl();
14
+ intervalID = setInterval(()=>{
15
+ findEl();
16
+ }, 50);
17
+ timeoutID = setTimeout(()=>{
18
+ if (intervalID) clearInterval(intervalID);
19
+ if (timeoutID) clearTimeout(timeoutID);
20
+ resolve(null);
21
+ }, timeout);
22
+ });
23
+ };
24
+
25
+ export { waitForElementToExist };
@@ -104,11 +104,13 @@ const DropElement = ()=>{
104
104
  className: "gp-flex gp-w-[291px] gp-justify-between",
105
105
  children: [
106
106
  /*#__PURE__*/ jsx("button", {
107
+ "data-button-add-section": true,
107
108
  onClick: ()=>dispatchEventBuildWithSectionActiveTab(true),
108
109
  className: "gp-flex gp-h-[40px] gp-w-[136px] gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#1C1C1C] gp-text-[14px] gp-text-white hover:gp-bg-[#3B3B3B]",
109
110
  children: "Add sections"
110
111
  }),
111
112
  /*#__PURE__*/ jsx("button", {
113
+ "data-button-add-elements": true,
112
114
  onClick: ()=>dispatchEventBuildWithSectionActiveTab(false),
113
115
  className: "gp-flex gp-h-[40px] gp-w-[136px] gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#f4f4f4] gp-text-[14px] gp-text-[#212121] hover:gp-bg-[#E2E2E2]",
114
116
  children: "Add elements"
@@ -139,7 +139,8 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
139
139
  customCodeHeader: dataBuilder.themePageCustomCode?.header ?? null,
140
140
  customCodeBody: dataBuilder.themePageCustomCode?.body ?? null,
141
141
  pageHandle: dataBuilder.handle ?? null,
142
- customFonts
142
+ customFonts,
143
+ interaction: dataBuilder?.interaction
143
144
  });
144
145
  } catch (err) {
145
146
  captureException(err);
@@ -1,17 +1,17 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderPreviewProvider, RenderPreview } from '@gem-sdk/core';
2
+ import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderPreviewProvider } from '@gem-sdk/core';
3
3
  import { NextSeo } from 'next-seo';
4
4
  import Head from 'next/head';
5
5
  import { useState, useMemo, useEffect } from 'react';
6
6
  import Toolbox from '../components/builder/Toolbox.js';
7
7
  import Header from '../components/builder/Header.js';
8
8
  import Footer from '../components/builder/Footer.js';
9
- import CollectionGlobalProvider from './CollectionGlobalProvider.js';
10
9
  import PopupManager from '../components/builder/PopupManager.js';
11
10
  import ImageToLayout from '../components/image-to-layout/ImageToLayout.js';
12
11
  import AddSectionImageToLayout from '../components/image-to-layout/AddSectionImageToLayout.js';
13
12
  import Toolbar from '../components/builder/Toolbar.js';
14
13
  import Devices from '../components/builder/SwitchView.js';
14
+ import Body from '../components/builder/Body.js';
15
15
 
16
16
  const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
17
17
  const [loadSuccess, setLoadSuccess] = useState(false);
@@ -81,16 +81,9 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
81
81
  isOriginTemplate: isOriginTemplate,
82
82
  openPageSetting: openPageSetting
83
83
  })),
84
- /*#__PURE__*/ jsx("div", {
85
- id: "storefront",
86
- className: `${isThemeSectionEditor ? 'theme-section-editor' : ''} ${pageType === 'POST_PURCHASE' ? 'post-purchase-page' : ''}`,
87
- children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
88
- children: /*#__PURE__*/ jsx(RenderPreview, {
89
- uid: "ROOT"
90
- })
91
- }) : /*#__PURE__*/ jsx(RenderPreview, {
92
- uid: "ROOT"
93
- })
84
+ /*#__PURE__*/ jsx(Body, {
85
+ pageType: pageType,
86
+ isThemeSectionEditor: isThemeSectionEditor
94
87
  }),
95
88
  /*#__PURE__*/ jsx(ImageToLayout, {
96
89
  editorImageToLayout: editorImageToLayout || false
@@ -7,9 +7,11 @@ import { useTrackingView } from '../libs/hooks/use-tracking-view.js';
7
7
  import { parseHtml } from '../libs/parse-html.js';
8
8
  import Header from '../components/builder/Header.js';
9
9
  import FooterForPostPurchase from '../components/FooterForPostPurchase.js';
10
+ import Script from 'next/script';
10
11
 
11
- const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview })=>{
12
+ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction })=>{
12
13
  const router = useRouter();
14
+ const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
13
15
  useTrackingView(shopToken, pageHandle, router.isFallback);
14
16
  if (router.isFallback) {
15
17
  return /*#__PURE__*/ jsx("div", {
@@ -79,17 +81,28 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
79
81
  isPostPurchase && /*#__PURE__*/ jsx(Header, {
80
82
  pageType: "POST_PURCHASE"
81
83
  }),
84
+ /*#__PURE__*/ jsx("div", {
85
+ dangerouslySetInnerHTML: {
86
+ __html: `<div id="gp-interaction" style="display: none;">${JSON.stringify(interaction?.value || [])}</div>`
87
+ }
88
+ }),
82
89
  /*#__PURE__*/ jsx(SectionProvider, {
83
90
  data: sectionData,
84
- children: builderData?.map((builder)=>/*#__PURE__*/ jsx(BuilderProvider, {
91
+ children: builderData?.map((builder)=>/*#__PURE__*/ jsxs(BuilderProvider, {
85
92
  state: builder.data,
86
93
  lazy: builder.lazy,
87
94
  priority: builder.priority,
88
95
  isPostPurchase: isPostPurchase,
89
96
  isPreview: isPreview,
90
- children: /*#__PURE__*/ jsx(Render, {
91
- uid: builder.uid
92
- })
97
+ children: [
98
+ /*#__PURE__*/ jsx(Render, {
99
+ uid: builder.uid
100
+ }),
101
+ /*#__PURE__*/ jsx(Script, {
102
+ defer: true,
103
+ src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
104
+ })
105
+ ]
93
106
  }, builder.uid))
94
107
  }),
95
108
  isPostPurchase && /*#__PURE__*/ jsx(FooterForPostPurchase, {
@@ -40,6 +40,7 @@ type PageBuilderProps = {
40
40
  customCodeBody?: string | null;
41
41
  isStorefront?: boolean;
42
42
  customFonts?: string | null;
43
+ interaction?: ShopType.Maybe<Pick<ShopType.PublishedPageInteraction, "id" | "value">>;
43
44
  };
44
45
  type PageBuilderPropsV2 = {
45
46
  builderData?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.56.0",
3
+ "version": "1.57.0-dev.45",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,10 +26,10 @@
26
26
  "next": "latest"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "1.56.0",
30
- "@gem-sdk/plugin-cookie-bar": "1.56.0",
31
- "@gem-sdk/plugin-quick-view": "1.56.0",
32
- "@gem-sdk/plugin-sticky-add-to-cart": "1.56.0"
29
+ "@gem-sdk/core": "1.57.0-dev.45",
30
+ "@gem-sdk/plugin-cookie-bar": "1.57.0-dev.45",
31
+ "@gem-sdk/plugin-quick-view": "1.57.0-dev.45",
32
+ "@gem-sdk/plugin-sticky-add-to-cart": "1.57.0-dev.45"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "next": ">=13"
@@ -1,110 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var react = require('react');
7
-
8
- const Onboarding = ({ enable, position, onCloseOnboarding })=>{
9
- const closeOnboarding = ()=>{
10
- onCloseOnboarding();
11
- };
12
- const videoSrc = 'https://ucarecdn.com/de5fd2eb-4525-45a7-ad13-53960dac225e/';
13
- const Video = ()=>{
14
- return /*#__PURE__*/ jsxRuntime.jsxs("video", {
15
- width: "100%",
16
- className: "gp-w-full",
17
- loop: true,
18
- muted: true,
19
- autoPlay: true,
20
- playsInline: true,
21
- children: [
22
- /*#__PURE__*/ jsxRuntime.jsx("source", {
23
- src: videoSrc,
24
- type: "video/mp4"
25
- }),
26
- "Sorry, your browser doesn‘t support embedded videos."
27
- ]
28
- });
29
- };
30
- const MemoVideo = /*#__PURE__*/ react.memo(Video);
31
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
32
- "data-toolbar-onboarding": true,
33
- "data-toolbar-onboarding-position": position,
34
- children: enable && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
35
- children: [
36
- /*#__PURE__*/ jsxRuntime.jsx("span", {
37
- "data-icon": true,
38
- "data-position": position,
39
- children: position === 'bottom' ? /*#__PURE__*/ jsxRuntime.jsx("svg", {
40
- width: "8",
41
- height: "4",
42
- viewBox: "0 0 8 4",
43
- fill: "none",
44
- xmlns: "http://www.w3.org/2000/svg",
45
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
46
- d: "M-1.74846e-07 4L4 -1.74846e-07L8 4L-1.74846e-07 4Z",
47
- fill: "white"
48
- })
49
- }) : /*#__PURE__*/ jsxRuntime.jsx("svg", {
50
- width: "8",
51
- height: "4",
52
- viewBox: "0 0 8 4",
53
- fill: "none",
54
- xmlns: "http://www.w3.org/2000/svg",
55
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
56
- d: "M8 3.33818e-07L4 4L4.76995e-08 7.15256e-07L8 3.33818e-07Z",
57
- fill: "white"
58
- })
59
- })
60
- }),
61
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
62
- "data-onboarding-wrapper": true,
63
- children: [
64
- /*#__PURE__*/ jsxRuntime.jsx("button", {
65
- "data-close": true,
66
- type: "button",
67
- onClick: closeOnboarding,
68
- children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
69
- width: "32",
70
- height: "32",
71
- viewBox: "0 0 32 32",
72
- fill: "none",
73
- xmlns: "http://www.w3.org/2000/svg",
74
- children: [
75
- /*#__PURE__*/ jsxRuntime.jsx("path", {
76
- fillRule: "evenodd",
77
- clipRule: "evenodd",
78
- d: "M10.6464 10.6464C10.8417 10.4512 11.1583 10.4512 11.3536 10.6464L21.3536 20.6464C21.5488 20.8417 21.5488 21.1583 21.3536 21.3536C21.1583 21.5488 20.8417 21.5488 20.6464 21.3536L10.6464 11.3536C10.4512 11.1583 10.4512 10.8417 10.6464 10.6464Z",
79
- fill: "#212121"
80
- }),
81
- /*#__PURE__*/ jsxRuntime.jsx("path", {
82
- fillRule: "evenodd",
83
- clipRule: "evenodd",
84
- d: "M21.3536 10.6464C21.5488 10.8417 21.5488 11.1583 21.3536 11.3536L11.3536 21.3536C11.1583 21.5488 10.8417 21.5488 10.6464 21.3536C10.4512 21.1583 10.4512 20.8417 10.6464 20.6464L20.6464 10.6464C20.8417 10.4512 21.1583 10.4512 21.3536 10.6464Z",
85
- fill: "#212121"
86
- })
87
- ]
88
- })
89
- }),
90
- /*#__PURE__*/ jsxRuntime.jsx(MemoVideo, {}),
91
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
92
- "data-content": true,
93
- children: [
94
- /*#__PURE__*/ jsxRuntime.jsx("h3", {
95
- children: "New way to select parent element"
96
- }),
97
- /*#__PURE__*/ jsxRuntime.jsx("p", {
98
- children: "Select parent from here in case you can‘t find yours at times."
99
- })
100
- ]
101
- })
102
- ]
103
- })
104
- ]
105
- })
106
- });
107
- };
108
- var Onboarding$1 = /*#__PURE__*/ react.memo(Onboarding);
109
-
110
- exports.default = Onboarding$1;
@@ -1,106 +0,0 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { memo } from 'react';
3
-
4
- const Onboarding = ({ enable, position, onCloseOnboarding })=>{
5
- const closeOnboarding = ()=>{
6
- onCloseOnboarding();
7
- };
8
- const videoSrc = 'https://ucarecdn.com/de5fd2eb-4525-45a7-ad13-53960dac225e/';
9
- const Video = ()=>{
10
- return /*#__PURE__*/ jsxs("video", {
11
- width: "100%",
12
- className: "gp-w-full",
13
- loop: true,
14
- muted: true,
15
- autoPlay: true,
16
- playsInline: true,
17
- children: [
18
- /*#__PURE__*/ jsx("source", {
19
- src: videoSrc,
20
- type: "video/mp4"
21
- }),
22
- "Sorry, your browser doesn‘t support embedded videos."
23
- ]
24
- });
25
- };
26
- const MemoVideo = /*#__PURE__*/ memo(Video);
27
- return /*#__PURE__*/ jsx("div", {
28
- "data-toolbar-onboarding": true,
29
- "data-toolbar-onboarding-position": position,
30
- children: enable && /*#__PURE__*/ jsxs(Fragment, {
31
- children: [
32
- /*#__PURE__*/ jsx("span", {
33
- "data-icon": true,
34
- "data-position": position,
35
- children: position === 'bottom' ? /*#__PURE__*/ jsx("svg", {
36
- width: "8",
37
- height: "4",
38
- viewBox: "0 0 8 4",
39
- fill: "none",
40
- xmlns: "http://www.w3.org/2000/svg",
41
- children: /*#__PURE__*/ jsx("path", {
42
- d: "M-1.74846e-07 4L4 -1.74846e-07L8 4L-1.74846e-07 4Z",
43
- fill: "white"
44
- })
45
- }) : /*#__PURE__*/ jsx("svg", {
46
- width: "8",
47
- height: "4",
48
- viewBox: "0 0 8 4",
49
- fill: "none",
50
- xmlns: "http://www.w3.org/2000/svg",
51
- children: /*#__PURE__*/ jsx("path", {
52
- d: "M8 3.33818e-07L4 4L4.76995e-08 7.15256e-07L8 3.33818e-07Z",
53
- fill: "white"
54
- })
55
- })
56
- }),
57
- /*#__PURE__*/ jsxs("div", {
58
- "data-onboarding-wrapper": true,
59
- children: [
60
- /*#__PURE__*/ jsx("button", {
61
- "data-close": true,
62
- type: "button",
63
- onClick: closeOnboarding,
64
- children: /*#__PURE__*/ jsxs("svg", {
65
- width: "32",
66
- height: "32",
67
- viewBox: "0 0 32 32",
68
- fill: "none",
69
- xmlns: "http://www.w3.org/2000/svg",
70
- children: [
71
- /*#__PURE__*/ jsx("path", {
72
- fillRule: "evenodd",
73
- clipRule: "evenodd",
74
- d: "M10.6464 10.6464C10.8417 10.4512 11.1583 10.4512 11.3536 10.6464L21.3536 20.6464C21.5488 20.8417 21.5488 21.1583 21.3536 21.3536C21.1583 21.5488 20.8417 21.5488 20.6464 21.3536L10.6464 11.3536C10.4512 11.1583 10.4512 10.8417 10.6464 10.6464Z",
75
- fill: "#212121"
76
- }),
77
- /*#__PURE__*/ jsx("path", {
78
- fillRule: "evenodd",
79
- clipRule: "evenodd",
80
- d: "M21.3536 10.6464C21.5488 10.8417 21.5488 11.1583 21.3536 11.3536L11.3536 21.3536C11.1583 21.5488 10.8417 21.5488 10.6464 21.3536C10.4512 21.1583 10.4512 20.8417 10.6464 20.6464L20.6464 10.6464C20.8417 10.4512 21.1583 10.4512 21.3536 10.6464Z",
81
- fill: "#212121"
82
- })
83
- ]
84
- })
85
- }),
86
- /*#__PURE__*/ jsx(MemoVideo, {}),
87
- /*#__PURE__*/ jsxs("div", {
88
- "data-content": true,
89
- children: [
90
- /*#__PURE__*/ jsx("h3", {
91
- children: "New way to select parent element"
92
- }),
93
- /*#__PURE__*/ jsx("p", {
94
- children: "Select parent from here in case you can‘t find yours at times."
95
- })
96
- ]
97
- })
98
- ]
99
- })
100
- ]
101
- })
102
- });
103
- };
104
- var Onboarding$1 = /*#__PURE__*/ memo(Onboarding);
105
-
106
- export { Onboarding$1 as default };