@stack-spot/portal-components 0.0.16 → 0.0.17

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 (139) hide show
  1. package/dist/Login.d.ts +1 -2
  2. package/dist/Login.d.ts.map +1 -1
  3. package/dist/Login.js +2 -2
  4. package/dist/Login.js.map +1 -1
  5. package/dist/components/BannerWarning.d.ts.map +1 -1
  6. package/dist/components/ChatBot.js.map +1 -1
  7. package/dist/components/Login.js.map +1 -1
  8. package/dist/components/MiniLogo.d.ts +3 -2
  9. package/dist/components/MiniLogo.d.ts.map +1 -1
  10. package/dist/components/src/components/BannerWarning.d.ts +4 -0
  11. package/dist/components/src/components/BannerWarning.d.ts.map +1 -0
  12. package/dist/components/src/components/BannerWarning.js +6 -0
  13. package/dist/components/src/components/BannerWarning.js.map +1 -0
  14. package/dist/components/src/components/Breadcrumb/index.d.ts +42 -0
  15. package/dist/components/src/components/Breadcrumb/index.d.ts.map +1 -0
  16. package/dist/components/src/components/Breadcrumb/index.js +27 -0
  17. package/dist/components/src/components/Breadcrumb/index.js.map +1 -0
  18. package/dist/components/src/components/Breadcrumb/styled.d.ts +3 -0
  19. package/dist/components/src/components/Breadcrumb/styled.d.ts.map +1 -0
  20. package/dist/components/src/components/Breadcrumb/styled.js +36 -0
  21. package/dist/components/src/components/Breadcrumb/styled.js.map +1 -0
  22. package/dist/components/src/components/ChatBot.d.ts +2 -0
  23. package/dist/components/src/components/ChatBot.d.ts.map +1 -0
  24. package/dist/components/src/components/ChatBot.js +61 -0
  25. package/dist/components/src/components/ChatBot.js.map +1 -0
  26. package/dist/components/src/components/Login.d.ts +26 -0
  27. package/dist/components/src/components/Login.d.ts.map +1 -0
  28. package/dist/components/src/components/Login.js +100 -0
  29. package/dist/components/src/components/Login.js.map +1 -0
  30. package/dist/{svg/Logo.d.ts → components/src/components/MiniLogo.d.ts} +2 -2
  31. package/dist/components/src/components/MiniLogo.d.ts.map +1 -0
  32. package/dist/components/src/components/MiniLogo.js +4 -0
  33. package/dist/components/src/components/MiniLogo.js.map +1 -0
  34. package/dist/components/src/components/tour/StepContainer.d.ts +13 -0
  35. package/dist/components/src/components/tour/StepContainer.d.ts.map +1 -0
  36. package/dist/components/src/components/tour/StepContainer.js +48 -0
  37. package/dist/components/src/components/tour/StepContainer.js.map +1 -0
  38. package/dist/components/src/components/tour/StepNavigation.d.ts +13 -0
  39. package/dist/components/src/components/tour/StepNavigation.d.ts.map +1 -0
  40. package/dist/components/src/components/tour/StepNavigation.js +20 -0
  41. package/dist/components/src/components/tour/StepNavigation.js.map +1 -0
  42. package/dist/components/src/components/tour/StepTitle.d.ts +7 -0
  43. package/dist/components/src/components/tour/StepTitle.d.ts.map +1 -0
  44. package/dist/components/src/components/tour/StepTitle.js +5 -0
  45. package/dist/components/src/components/tour/StepTitle.js.map +1 -0
  46. package/dist/components/src/components/tour/context.d.ts +17 -0
  47. package/dist/components/src/components/tour/context.d.ts.map +1 -0
  48. package/dist/components/src/components/tour/context.js +48 -0
  49. package/dist/components/src/components/tour/context.js.map +1 -0
  50. package/dist/components/src/components/tour/index.d.ts +4 -0
  51. package/dist/components/src/components/tour/index.d.ts.map +1 -0
  52. package/dist/components/src/components/tour/index.js +4 -0
  53. package/dist/components/src/components/tour/index.js.map +1 -0
  54. package/dist/components/src/components/tour/utils.d.ts +13 -0
  55. package/dist/components/src/components/tour/utils.d.ts.map +1 -0
  56. package/dist/components/src/components/tour/utils.js +43 -0
  57. package/dist/components/src/components/tour/utils.js.map +1 -0
  58. package/dist/components/src/hooks/service-now.d.ts +24 -0
  59. package/dist/components/src/hooks/service-now.d.ts.map +1 -0
  60. package/dist/components/src/hooks/service-now.js +161 -0
  61. package/dist/components/src/hooks/service-now.js.map +1 -0
  62. package/dist/components/src/hooks/title.d.ts +3 -0
  63. package/dist/components/src/hooks/title.d.ts.map +1 -0
  64. package/dist/components/src/hooks/title.js +13 -0
  65. package/dist/components/src/hooks/title.js.map +1 -0
  66. package/dist/components/src/hooks/use-effect-once.d.ts +12 -0
  67. package/dist/components/src/hooks/use-effect-once.d.ts.map +1 -0
  68. package/dist/components/src/hooks/use-effect-once.js +40 -0
  69. package/dist/components/src/hooks/use-effect-once.js.map +1 -0
  70. package/dist/components/src/index.d.ts +9 -0
  71. package/dist/components/src/index.d.ts.map +1 -0
  72. package/dist/components/src/index.js +9 -0
  73. package/dist/components/src/index.js.map +1 -0
  74. package/dist/components/tour/StepContainer.d.ts +13 -0
  75. package/dist/components/tour/StepContainer.d.ts.map +1 -0
  76. package/dist/components/tour/StepContainer.js +48 -0
  77. package/dist/components/tour/StepContainer.js.map +1 -0
  78. package/dist/components/tour/StepNavigation.d.ts +13 -0
  79. package/dist/components/tour/StepNavigation.d.ts.map +1 -0
  80. package/dist/components/tour/StepNavigation.js +20 -0
  81. package/dist/components/tour/StepNavigation.js.map +1 -0
  82. package/dist/components/tour/StepTitle.d.ts +7 -0
  83. package/dist/components/tour/StepTitle.d.ts.map +1 -0
  84. package/dist/components/tour/StepTitle.js +5 -0
  85. package/dist/components/tour/StepTitle.js.map +1 -0
  86. package/dist/components/tour/context.d.ts +17 -0
  87. package/dist/components/tour/context.d.ts.map +1 -0
  88. package/dist/components/tour/context.js +48 -0
  89. package/dist/components/tour/context.js.map +1 -0
  90. package/dist/components/tour/index.d.ts +9 -0
  91. package/dist/components/tour/index.d.ts.map +1 -0
  92. package/dist/components/tour/index.js +4 -0
  93. package/dist/components/tour/index.js.map +1 -0
  94. package/dist/components/tour/utils.d.ts +13 -0
  95. package/dist/components/tour/utils.d.ts.map +1 -0
  96. package/dist/components/tour/utils.js +43 -0
  97. package/dist/components/tour/utils.js.map +1 -0
  98. package/dist/hooks/service-now.js.map +1 -1
  99. package/dist/hooks/use-effect-once.js.map +1 -1
  100. package/dist/index.d.ts +1 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +1 -0
  103. package/dist/index.js.map +1 -1
  104. package/dist/layout/src/components/tour/PortalSwitcherStep.d.ts +2 -0
  105. package/dist/layout/src/components/tour/PortalSwitcherStep.d.ts.map +1 -0
  106. package/dist/layout/src/components/tour/PortalSwitcherStep.js +30 -0
  107. package/dist/layout/src/components/tour/PortalSwitcherStep.js.map +1 -0
  108. package/package.json +9 -7
  109. package/src/components/tour/StepContainer.tsx +67 -0
  110. package/src/components/tour/StepNavigation.tsx +32 -0
  111. package/src/components/tour/StepTitle.tsx +17 -0
  112. package/src/components/tour/context.tsx +56 -0
  113. package/src/components/tour/index.ts +7 -0
  114. package/src/components/tour/utils.tsx +65 -0
  115. package/src/index.ts +1 -0
  116. package/tsconfig.json +4 -2
  117. package/dist/ErrorFeedback.d.ts +0 -7
  118. package/dist/ErrorFeedback.d.ts.map +0 -1
  119. package/dist/ErrorFeedback.js +0 -66
  120. package/dist/ErrorFeedback.js.map +0 -1
  121. package/dist/svg/Forbidden.d.ts +0 -6
  122. package/dist/svg/Forbidden.d.ts.map +0 -1
  123. package/dist/svg/Forbidden.js +0 -4
  124. package/dist/svg/Forbidden.js.map +0 -1
  125. package/dist/svg/Logo.d.ts.map +0 -1
  126. package/dist/svg/Logo.js +0 -4
  127. package/dist/svg/Logo.js.map +0 -1
  128. package/dist/svg/NotFound.d.ts +0 -6
  129. package/dist/svg/NotFound.d.ts.map +0 -1
  130. package/dist/svg/NotFound.js +0 -4
  131. package/dist/svg/NotFound.js.map +0 -1
  132. package/dist/svg/ServerError.d.ts +0 -6
  133. package/dist/svg/ServerError.d.ts.map +0 -1
  134. package/dist/svg/ServerError.js +0 -4
  135. package/dist/svg/ServerError.js.map +0 -1
  136. package/dist/svg/Unauthenticated.d.ts +0 -6
  137. package/dist/svg/Unauthenticated.d.ts.map +0 -1
  138. package/dist/svg/Unauthenticated.js +0 -4
  139. package/dist/svg/Unauthenticated.js.map +0 -1
@@ -0,0 +1,13 @@
1
+ import '@stack-spot/portal-theme/dist/theme.css';
2
+ type CustomNavigationButton = {
3
+ text: string;
4
+ onClick?: () => void;
5
+ };
6
+ export type NavigationProps = {
7
+ stepKey: string;
8
+ nextButton?: CustomNavigationButton;
9
+ prevButton?: CustomNavigationButton;
10
+ };
11
+ export declare const StepNavigation: ({ stepKey, nextButton, prevButton }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=StepNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepNavigation.d.ts","sourceRoot":"","sources":["../../../../../src/components/tour/StepNavigation.tsx"],"names":[],"mappings":"AACA,OAAO,yCAAyC,CAAA;AAKhD,KAAK,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;AACpE,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,sBAAsB,CAAC;IAAC,UAAU,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAE3H,eAAO,MAAM,cAAc,wCAAyC,eAAe,4CAsBlF,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button, Flex, Text } from '@citric/core';
3
+ import '@stack-spot/portal-theme/dist/theme.css';
4
+ import { useTranslate } from '@stack-spot/portal-translate';
5
+ import { useTour } from './context.js';
6
+ import { finishTourStep } from './utils.js';
7
+ export const StepNavigation = ({ stepKey, nextButton, prevButton }) => {
8
+ const { currentStep, steps, nextStep, prevStep } = useTour();
9
+ const t = useTranslate({ en: { of: 'of', back: 'back' }, pt: { of: 'de', back: 'voltar' } });
10
+ return _jsxs(Flex, { w: 12, px: 5, py: 2, mt: "-1px", bg: "inverse.500", justifyContent: "space-between", children: [_jsxs(Text, { appearance: "microtext1", colorScheme: "inverse.contrastText", children: [currentStep + 1, " ", t.of, " ", steps.length] }), _jsxs(Flex, { sx: { gap: '8px' }, children: [currentStep >= 1 &&
11
+ _jsx(Button, { sx: { paddingInline: '20px' }, onClick: () => {
12
+ prevStep?.();
13
+ prevButton?.onClick?.();
14
+ }, size: "sm", colorScheme: "light", children: prevButton?.text || t.back }), _jsx(Button, { sx: { paddingInline: '20px' }, onClick: () => {
15
+ nextButton?.onClick?.();
16
+ nextStep?.();
17
+ finishTourStep(stepKey);
18
+ }, size: "sm", colorScheme: "light", children: nextButton?.text || 'ok' })] })] });
19
+ };
20
+ //# sourceMappingURL=StepNavigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepNavigation.js","sourceRoot":"","sources":["../../../../../src/components/tour/StepNavigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,yCAAyC,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKxC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAmB,EAAE,EAAE;IACrF,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAA;IAC5D,MAAM,CAAC,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;IAC5F,OAAO,MAAC,IAAI,IAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAC,MAAM,EAAC,EAAE,EAAC,aAAa,EAAC,cAAc,EAAC,eAAe,aACzF,MAAC,IAAI,IAAC,UAAU,EAAC,YAAY,EAAC,WAAW,EAAC,sBAAsB,aAAE,WAAW,GAAG,CAAC,OAAG,CAAC,CAAC,EAAE,OAAG,KAAK,CAAC,MAAM,IAAQ,EAC/G,MAAC,IAAI,IAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,aACrB,WAAW,IAAI,CAAC;wBACf,KAAC,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;gCACnD,QAAQ,EAAE,EAAE,CAAA;gCACZ,UAAU,EAAE,OAAO,EAAE,EAAE,CAAA;4BACzB,CAAC,EAAE,IAAI,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,YAC7B,UAAU,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,GACpB,EACX,KAAC,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;4BACnD,UAAU,EAAE,OAAO,EAAE,EAAE,CAAA;4BACvB,QAAQ,EAAE,EAAE,CAAA;4BACZ,cAAc,CAAC,OAAO,CAAC,CAAA;wBACzB,CAAC,EAAE,IAAI,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,YAC7B,UAAU,EAAE,IAAI,IAAI,IAAI,GAClB,IACJ,IACF,CAAA;AACT,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ type StepTitleProps = {
2
+ title: string;
3
+ onClose?: () => void;
4
+ };
5
+ export declare const StepTitle: ({ title, onClose }: StepTitleProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=StepTitle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepTitle.d.ts","sourceRoot":"","sources":["../../../../../src/components/tour/StepTitle.tsx"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,SAAS,uBAAwB,cAAc,4CAQnD,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button, Flex, IconBox, Text } from '@citric/core';
3
+ import { TimesMini } from '@citric/icons';
4
+ export const StepTitle = ({ title, onClose }) => _jsxs(Flex, { w: 12, pl: 5, py: 3, flexWrap: "nowrap", justifyContent: "space-between", alignItems: "center", children: [_jsxs(Text, { appearance: "body2", colorScheme: "inverse.contrastText", weight: "medium", children: [" ", title, " "] }), _jsx(Button, { appearance: "text", size: "sm", onClick: () => onClose?.(), sx: { ':hover': { borderColor: 'transparent !important' } }, children: _jsx(IconBox, { size: "xs", colorIcon: "inverse.contrastText", children: _jsx(TimesMini, {}) }) })] });
5
+ //# sourceMappingURL=StepTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepTitle.js","sourceRoot":"","sources":["../../../../../src/components/tour/StepTitle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAOzC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAkB,EAAE,EAAE,CAC9D,MAAC,IAAI,IAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe,EAAC,UAAU,EAAC,QAAQ,aAC7F,MAAC,IAAI,IAAC,UAAU,EAAC,OAAO,EAAC,WAAW,EAAC,sBAAsB,EAAC,MAAM,EAAC,QAAQ,kBAAG,KAAK,SAAS,EAC5F,KAAC,MAAM,IAAC,UAAU,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,EAAE,YACzH,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,sBAAsB,YACjD,KAAC,SAAS,KAAG,GACL,GACH,IACJ,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { ReactourProps } from 'reactour';
3
+ type TourConfig = Omit<ReactourProps, 'children'>;
4
+ export declare const defaultTourConfig: TourConfig;
5
+ export declare const TourProvider: ({ config, children }: {
6
+ config: TourConfig;
7
+ children: ReactNode;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const useTour: () => {
10
+ currentStep: number;
11
+ nextStep: (() => void) | undefined;
12
+ prevStep: (() => void) | undefined;
13
+ steps: import("reactour").ReactourStep[];
14
+ finishStep: (stepKey: string) => void;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/components/tour/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuC,MAAM,OAAO,CAAA;AACtE,OAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAG9C,KAAK,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;AAEjD,eAAO,MAAM,iBAAiB,EAAE,UAU9B,CAAA;AAOF,eAAO,MAAM,YAAY;YAAoC,UAAU;cAAY,SAAS;6CAkB3F,CAAA;AAED,eAAO,MAAM,OAAO;;;;;0BAOM,MAAM;CAK/B,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState } from 'react';
3
+ import Tour from 'reactour';
4
+ import { finishTourStep } from './utils.js';
5
+ export const defaultTourConfig = Object.freeze({
6
+ steps: [],
7
+ isOpen: true,
8
+ onRequestClose: () => '',
9
+ showButtons: false,
10
+ showNavigation: false,
11
+ showNavigationNumber: false,
12
+ showNumber: false,
13
+ showCloseButton: false,
14
+ disableFocusLock: true,
15
+ });
16
+ const TourContext = createContext({
17
+ tourConfig: defaultTourConfig,
18
+ currentStep: 0,
19
+ });
20
+ export const TourProvider = ({ config, children }) => {
21
+ const [currentStep, setCurrentStep] = useState(0);
22
+ const tourConfig = {
23
+ ...config,
24
+ goToStep: currentStep,
25
+ update: `${currentStep}`,
26
+ nextStep: () => setCurrentStep(currentStep + 1),
27
+ prevStep: () => setCurrentStep(currentStep - 1),
28
+ isOpen: !!config.steps.length && (currentStep < config.steps.length),
29
+ };
30
+ return _jsxs(TourContext.Provider, { value: {
31
+ currentStep,
32
+ tourConfig,
33
+ }, children: [_jsx(Tour, { ...tourConfig }), children] });
34
+ };
35
+ export const useTour = () => {
36
+ const { currentStep, tourConfig: { nextStep, prevStep, steps } } = useContext(TourContext);
37
+ return {
38
+ currentStep,
39
+ nextStep,
40
+ prevStep,
41
+ steps,
42
+ finishStep: (stepKey) => {
43
+ finishTourStep(stepKey);
44
+ nextStep?.();
45
+ },
46
+ };
47
+ };
48
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../../src/components/tour/context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtE,OAAO,IAAuB,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,MAAM,CAAC,MAAM,iBAAiB,GAAe,MAAM,CAAC,MAAM,CAAC;IACzD,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE;IACxB,WAAW,EAAE,KAAK;IAClB,cAAc,EAAE,KAAK;IACrB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,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AA;QACd,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { StepContainer } from './StepContainer.js';
2
+ export { TourProvider, defaultTourConfig, useTour } from './context.js';
3
+ export { isNewTourStep, tourStepBuilder } from './utils.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/tour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { StepContainer } from './StepContainer.js';
2
+ export { TourProvider, defaultTourConfig, useTour } from './context.js';
3
+ export { isNewTourStep, tourStepBuilder } from './utils.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/tour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { ReactourStep } from 'reactour';
3
+ import { NavigationProps } from './StepNavigation.js';
4
+ export declare const finishTourStep: (key: string) => void;
5
+ export declare const isNewTourStep: (step: ReactourStep) => boolean;
6
+ export declare const hasFinishedTourStep: (key: string) => boolean;
7
+ export declare const tourStepBuilder: ({ selector, position, title, content, style, customNavigation, ...rest }: ReactourStep & {
8
+ title: string;
9
+ selector: string;
10
+ content: ReactNode;
11
+ customNavigation?: NavigationProps | undefined;
12
+ }) => ReactourStep;
13
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/tour/utils.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAyBlD,eAAO,MAAM,cAAc,QAAS,MAAM,SAIzC,CAAA;AAED,eAAO,MAAM,aAAa,SAAU,YAAY,YAA6C,CAAA;AAC7F,eAAO,MAAM,mBAAmB,QAAS,MAAM,YAAkC,CAAA;AAEjF,eAAO,MAAM,eAAe;WAQD,MAAM;cAAY,MAAM;aAAW,SAAS;;MAAyC,YAkB9G,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { theme } from '@stack-spot/portal-theme';
3
+ import { StepContainer } from './StepContainer.js';
4
+ const TOUR_COOKIE = 'guided-tour-global';
5
+ const DOMAIN_REGEX = new RegExp(/(\.*(prd|stg|dev)*.stackspot.com)|localhost/);
6
+ const portalUrl = new URL(location.href);
7
+ const cookieDomain = DOMAIN_REGEX.exec(portalUrl.host)?.[0];
8
+ const defaultCookieAttributes = `domain=${cookieDomain}; SameSite=Strict;`;
9
+ const getCookies = () => document.cookie.split('; ').reduce((prev, current) => {
10
+ const [name, ...value] = current.split('=');
11
+ prev[name] = value.join('=');
12
+ return prev;
13
+ }, {});
14
+ const setCookie = (key, value) => {
15
+ document.cookie = `${key}=${value}; ${defaultCookieAttributes}`;
16
+ };
17
+ const getCookie = (key) => getCookies()[key];
18
+ const getTourCookie = () => {
19
+ const currentTourObject = getCookie(TOUR_COOKIE);
20
+ return currentTourObject ? currentTourObject.split(',') : [];
21
+ };
22
+ export const finishTourStep = (key) => {
23
+ const tourObject = getTourCookie();
24
+ if (!tourObject.includes(key))
25
+ tourObject.push(key);
26
+ setCookie(TOUR_COOKIE, tourObject.toString());
27
+ };
28
+ export const isNewTourStep = (step) => !hasFinishedTourStep(`${step.selector}`);
29
+ export const hasFinishedTourStep = (key) => getTourCookie().includes(key);
30
+ export const tourStepBuilder = ({ selector, position, title, content, style, customNavigation, ...rest }) => ({
31
+ selector,
32
+ content: (_jsx(StepContainer, { stepKey: selector, position: position, title: title, customNavigation: customNavigation, children: content })),
33
+ position,
34
+ style: {
35
+ backgroundColor: theme.color.inverse[500],
36
+ width: '256px',
37
+ padding: 0,
38
+ top: ['right', 'left'].includes(position) ? '-3px' : '0',
39
+ ...(style || {}),
40
+ },
41
+ ...(rest || {}),
42
+ });
43
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/components/tour/utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAGhD,OAAO,EAAyB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAGtE,MAAM,WAAW,GAAG,oBAAoB,CAAA;AACxC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,6CAA6C,CAAC,CAAA;AAC9E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACxC,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC3D,MAAM,uBAAuB,GAAG,UAAU,YAAY,oBAAoB,CAAA;AAE1E,MAAM,UAAU,GAAG,GAA2B,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;IACpG,MAAM,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;I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K,EACL,OAAO,EACP,KAAK,EACL,gBAAgB,EAChB,GAAG,IAAI,EACoG,EAAgB,EAAE,CAAC,CAAC;IAC/H,QAAQ;IACR,OAAO,EAAE,CAAC,KAAC,aAAa,IACtB,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,QAAiC,EAC3C,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,YACjC,OAAO,GACM,CAAC;IACjB,QAAQ;IACR,KAAK,EAAE;QACL,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACzC,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAiC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG;QACjF,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;KACjB;IACD,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;CAChB,CAAC,CAAA"}
@@ -0,0 +1,24 @@
1
+ interface Options {
2
+ onClose?: () => void;
3
+ }
4
+ export declare function getServiceNowLauncher(): HTMLElement | null;
5
+ export declare function openServiceNowChat(): void;
6
+ export declare function addOrRemoveServiceNowLauncher(action: string): void;
7
+ export declare function useServiceNowChatButtonVisibility(): boolean;
8
+ export declare function useServiceNowEffect(options?: Options): void;
9
+ export declare const dictionary: {
10
+ en: {
11
+ errorLoadScript: string;
12
+ hide: string;
13
+ hiddenTitle: string;
14
+ hiddenMessage: string;
15
+ };
16
+ pt: {
17
+ errorLoadScript: string;
18
+ hide: string;
19
+ hiddenTitle: string;
20
+ hiddenMessage: string;
21
+ };
22
+ };
23
+ export {};
24
+ //# sourceMappingURL=service-now.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-now.d.ts","sourceRoot":"","sources":["../../../../src/hooks/service-now.tsx"],"names":[],"mappings":"AAwCA,UAAU,OAAO;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAuBD,wBAAgB,qBAAqB,uBAEpC;AAED,wBAAgB,kBAAkB,SAIjC;AAaD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,QAU3D;AAkED,wBAAgB,iCAAiC,YAIhD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO,QAIpD;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAaD,CAAA"}
@@ -0,0 +1,161 @@
1
+ import { getLanguage, translate } from '@stack-spot/portal-translate';
2
+ import { pull } from 'lodash';
3
+ import { useState } from 'react';
4
+ import { useEffectOnce } from './use-effect-once.js';
5
+ const closeButtonStyle = `
6
+ position: absolute;
7
+ bottom: -64px;
8
+ right: 60px;
9
+ width: 20px;
10
+ height: 20px;
11
+ display: flex;
12
+ align-items: center;
13
+ justify-content: center;
14
+ background-color: #BCBCCF;
15
+ border: none;
16
+ outline: none;
17
+ border-radius: 50%;
18
+ font: 400 20px Roboto, sans-serif;
19
+ color: #0B0B0E;
20
+ cursor: pointer;
21
+ transform: scale(0);
22
+ transition: transform 0.2s;
23
+ z-index: 999999;
24
+ `;
25
+ const iframeStyle = `
26
+ position: fixed;
27
+ display: none;
28
+ right: 15px;
29
+ bottom: 88px;
30
+ max-height: calc(100vh - 152px);
31
+ border-radius: 12px;
32
+ width: 380px;
33
+ height: 600px;
34
+ `;
35
+ const HOVER_AREA_PX = 100;
36
+ const LOCAL_STORAGE_SERVICE_NOW_VALUE = 'serviceNowChatButtonVisible';
37
+ const chatVisibilityListeners = [];
38
+ const serviceNowReference = 'https://zup.service-now.com/sn_va_web_client_app_embed.do?sysparm_branding_key=stackspotvirtualagent&sysparm_topic=f2b636c11bb50e50fe670dcbe54bcb1d';
39
+ function loadScript(src) {
40
+ return new Promise((resolve, reject) => {
41
+ const iframe = document.createElement('iframe');
42
+ const serviceNowContent = document.getElementById('service-now-content');
43
+ iframe.setAttribute('id', 'sn_va_web_client');
44
+ iframe.setAttribute('src', src);
45
+ iframe.style.cssText = iframeStyle;
46
+ iframe.onload = () => resolve();
47
+ iframe.onerror = (error) => reject(error);
48
+ serviceNowContent && serviceNowContent.appendChild(iframe);
49
+ });
50
+ }
51
+ export function getServiceNowLauncher() {
52
+ return document.getElementById('sn_va_web_client');
53
+ }
54
+ export function openServiceNowChat() {
55
+ hideOrShowServiceNowContent('visible');
56
+ addOrRemoveServiceNowLauncher('add');
57
+ showServiceNowChatButton();
58
+ }
59
+ function getServiceNowButton() {
60
+ return document.getElementById('service-now-button');
61
+ }
62
+ function hideOrShowServiceNowContent(action) {
63
+ const content = document.getElementById('service-now-content');
64
+ if (content) {
65
+ content.style.visibility = action;
66
+ }
67
+ }
68
+ export function addOrRemoveServiceNowLauncher(action) {
69
+ const launcher = getServiceNowLauncher();
70
+ const isAdd = action === 'add';
71
+ if (launcher) {
72
+ isAdd ? launcher.classList.add('show') : launcher.classList.remove('show');
73
+ const content = document.getElementById('service-now-content');
74
+ isAdd ? content?.classList.add('opened') : content?.classList.remove('opened');
75
+ launcher.style.display = isAdd ? 'block' : 'none';
76
+ }
77
+ }
78
+ function addChatVisibilityListener(listener) {
79
+ chatVisibilityListeners.push(listener);
80
+ return () => pull(chatVisibilityListeners, listener);
81
+ }
82
+ function renderCloseButton(onClose) {
83
+ const serviceNowButton = getServiceNowButton();
84
+ const anchor = serviceNowButton?.parentElement;
85
+ if (!anchor)
86
+ return;
87
+ const close = document.createElement('button');
88
+ close.setAttribute('id', 'close-service-now');
89
+ close.style.cssText = closeButtonStyle;
90
+ close.textContent = '-';
91
+ close.addEventListener('click', () => hideServiceNowChatButton(onClose));
92
+ anchor.appendChild(close);
93
+ serviceNowButton.addEventListener('mouseenter', () => {
94
+ const t = translate(dictionary, getLanguage());
95
+ close.setAttribute('title', t.hide);
96
+ close.style.transform = 'scale(1)';
97
+ const onMouseMove = (ev) => {
98
+ if (ev.clientX < window.innerWidth - HOVER_AREA_PX || ev.clientY < window.innerHeight - HOVER_AREA_PX) {
99
+ close.style.transform = 'scale(0)';
100
+ window.removeEventListener('mousemove', onMouseMove);
101
+ }
102
+ };
103
+ window.addEventListener('mousemove', onMouseMove);
104
+ });
105
+ }
106
+ function showServiceNowChatButton() {
107
+ getServiceNowButton()?.classList?.add('show');
108
+ localStorage.setItem(LOCAL_STORAGE_SERVICE_NOW_VALUE, 'true');
109
+ chatVisibilityListeners.forEach(l => l(true));
110
+ }
111
+ function hideServiceNowChatButton(onClose) {
112
+ hideOrShowServiceNowContent('hidden');
113
+ addOrRemoveServiceNowLauncher('remove');
114
+ getServiceNowButton()?.classList?.remove('show');
115
+ localStorage.setItem(LOCAL_STORAGE_SERVICE_NOW_VALUE, 'false');
116
+ onClose?.();
117
+ chatVisibilityListeners.forEach(l => l(false));
118
+ }
119
+ function isServiceNowChatButtonVisible() {
120
+ return localStorage.getItem(LOCAL_STORAGE_SERVICE_NOW_VALUE) !== 'false';
121
+ }
122
+ async function initializeChat({ onClose } = {}) {
123
+ try {
124
+ await loadScript(serviceNowReference);
125
+ if (isServiceNowChatButtonVisible())
126
+ showServiceNowChatButton();
127
+ else
128
+ hideServiceNowChatButton();
129
+ renderCloseButton(onClose);
130
+ }
131
+ catch {
132
+ const t = translate(dictionary, getLanguage());
133
+ // eslint-disable-next-line no-console
134
+ console.warn(t.errorLoadScript);
135
+ }
136
+ }
137
+ export function useServiceNowChatButtonVisibility() {
138
+ const [visible, setVisible] = useState(isServiceNowChatButtonVisible());
139
+ useEffectOnce(() => addChatVisibilityListener(setVisible));
140
+ return visible;
141
+ }
142
+ export function useServiceNowEffect(options) {
143
+ useEffectOnce(() => {
144
+ initializeChat(options);
145
+ });
146
+ }
147
+ export const dictionary = {
148
+ en: {
149
+ errorLoadScript: 'An error occurred while loading the script:',
150
+ hide: 'Hide chat button',
151
+ hiddenTitle: 'The chat button is now hidden',
152
+ hiddenMessage: 'To see it again, please select the option "Chat with us" in the menu just under this message.',
153
+ },
154
+ pt: {
155
+ errorLoadScript: 'Ocorreu um erro ao carregar o script:',
156
+ hide: 'Esconder o botão de chat',
157
+ hiddenTitle: 'O botão de chat foi escondido',
158
+ hiddenMessage: 'Para vê-lo novamente, por favor escolha a opção "Converse conosco" no menu logo em baixo desta mensagem.',
159
+ },
160
+ };
161
+ //# sourceMappingURL=service-now.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-now.js","sourceRoot":"","sources":["../../../../src/hooks/service-now.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACjF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;CAmBxB,CAAA;AAED,MAAM,WAAW,GAAG;;;;;;;;;CASnB,CAAA;AAQD,MAAM,aAAa,GAAG,GAAG,CAAA;AACzB,MAAM,+BAA+B,GAAG,6BAA6B,CAAA;AACrE,MAAM,uBAAuB,GAA6B,EAAE,CAAA;AAE5D,MAAM,mBAAmB,GAAG,qJAAqJ,CAAA;AAEjL,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QAC/C,MAAM,iBAAiB,GAAG,QAAQ,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAA;QACxE,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;QAC7C,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QAC/B,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,WAAW,CAAA;QAElC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,O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;;YAC1D,wBAAwB,EAAE,CAAA;QAC/B,iBAAiB,CAAC,OAAO,CAAC,CAAA;KAC3B;IAAC,MAAM;QACN,MAAM,CAAC,GAAG,SAAS,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC,CAAA;QAC9C,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;KAChC;AACH,CAAC;AAED,MAAM,UAAU,iCAAiC;IAC/C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,6BAA6B,EAAE,CAAC,CAAA;IACvE,aAAa,CAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,CAAA;IAC1D,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAiB;IACnD,aAAa,CAAC,GAAG,EAAE;QACjB,cAAc,CAAC,OAAO,CAAC,CAAA;IACzB,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,eAAe,EAAE,6CAA6C;QAC9D,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,+BAA+B;QAC5C,aAAa,EAAE,+FAA+F;KAC/G;IACD,EAAE,EAAE;QACF,eAAe,EAAE,uCAAuC;QACxD,IAAI,EAAE,0BAA0B;QAChC,WAAW,EAAE,+BAA+B;QAC5C,aAAa,EAAE,0GAA0G;KAC1H;CACmB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare function titleEffect(title: string | undefined | null): () => void;
2
+ export declare function useTitleEffect(title: string | undefined | null): void;
3
+ //# sourceMappingURL=title.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../../src/hooks/title.tsx"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,cAM3D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,QAE9D"}
@@ -0,0 +1,13 @@
1
+ import { useEffect } from 'react';
2
+ let originalTitle;
3
+ export function titleEffect(title) {
4
+ originalTitle ??= document.title;
5
+ document.title = title ? `${title} - ${originalTitle}` : originalTitle;
6
+ return () => {
7
+ document.title = originalTitle ?? '';
8
+ };
9
+ }
10
+ export function useTitleEffect(title) {
11
+ useEffect(() => titleEffect(title), [title]);
12
+ }
13
+ //# sourceMappingURL=title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title.js","sourceRoot":"","sources":["../../../../src/hooks/title.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,IAAI,aAAiC,CAAA;AAErC,MAAM,UAAU,WAAW,CAAC,KAAgC;IAC1D,aAAa,KAAK,QAAQ,CAAC,KAAK,CAAA;IAChC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,aAAa,EAAE,CAAC,CAAC,CAAC,aAAa,CAAA;IACtE,OAAO,GAAG,EAAE;QACV,QAAQ,CAAC,KAAK,GAAG,aAAa,IAAI,EAAE,CAAA;IACtC,CAAC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AAC9C,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Code taken from https://blog.ag-grid.com/avoiding-react-18-double-mount/
3
+ *
4
+ * Attention: don't use this hook unless you really have to!
5
+ *
6
+ * This hook fixes the React 18 behavior of calling useEffect hooks twice in strict/development mode, which ruins some mounting/unmounting
7
+ * behaviors.
8
+ *
9
+ * @param effect refer to React's useEffect.
10
+ */
11
+ export declare const useEffectOnce: (effect: () => void | (() => void)) => void;
12
+ //# sourceMappingURL=use-effect-once.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-effect-once.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-effect-once.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,SA8B9D,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ /**
3
+ * Code taken from https://blog.ag-grid.com/avoiding-react-18-double-mount/
4
+ *
5
+ * Attention: don't use this hook unless you really have to!
6
+ *
7
+ * This hook fixes the React 18 behavior of calling useEffect hooks twice in strict/development mode, which ruins some mounting/unmounting
8
+ * behaviors.
9
+ *
10
+ * @param effect refer to React's useEffect.
11
+ */
12
+ export const useEffectOnce = (effect) => {
13
+ const effectFn = useRef(effect);
14
+ const destroyFn = useRef();
15
+ const effectCalled = useRef(false);
16
+ const rendered = useRef(false);
17
+ const [, setVal] = useState(0);
18
+ if (effectCalled.current) {
19
+ rendered.current = true;
20
+ }
21
+ useEffect(() => {
22
+ // only execute the effect first time around
23
+ if (!effectCalled.current) {
24
+ destroyFn.current = effectFn.current();
25
+ effectCalled.current = true;
26
+ }
27
+ // this forces one render after the effect is run
28
+ setVal((val) => val + 1);
29
+ return () => {
30
+ // if the comp didn't render since the useEffect was called,
31
+ // we know it's the dummy React cycle
32
+ if (!rendered.current)
33
+ return;
34
+ // otherwise this is not a dummy destroy, so call the destroy func
35
+ if (destroyFn.current)
36
+ destroyFn.current();
37
+ };
38
+ }, []);
39
+ };
40
+ //# sourceMappingURL=use-effect-once.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-effect-once.js","sourceRoot":"","sources":["../../../../src/hooks/use-effect-once.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAiC,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAG,MAAM,CAA4B,MAAM,CAAC,CAAA;IAC1D,MAAM,SAAS,GAAG,MAAM,EAAuB,CAAA;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAA;IAEtC,IAAI,YAAY,CAAC,OAAO,EAAE;QACxB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAA;KACxB;IAED,SAAS,CAAC,GAAG,EAAE;QACb,4CAA4C;QAC5C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACzB,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAA;YACtC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;SAC5B;QAED,iDAAiD;QACjD,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;QAExB,OAAO,GAAG,EAAE;YACV,4DAA4D;YAC5D,qCAAqC;YACrC,IAAI,CAAC,QAAQ,CAAC,OAAO;gBAAE,OAAM;YAE7B,kEAAkE;YAClE,IAAI,SAAS,CAAC,OAAO;gBAAE,SAAS,CAAC,OAAO,EAAE,CAAA;QAC5C,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export { BannerWarning } from './components/BannerWarning.js';
2
+ export { BreadcrumbList } from './components/Breadcrumb/index.js';
3
+ export { ChatBot } from './components/ChatBot.js';
4
+ export { Login } from './components/Login.js';
5
+ export * from './components/tour/index.js';
6
+ export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect, } from './hooks/service-now.js';
7
+ export { titleEffect, useTitleEffect } from './hooks/title.js';
8
+ export { useEffectOnce } from './hooks/use-effect-once.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,OAAO,EACL,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,GAC/G,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,9 @@
1
+ export { BannerWarning } from './components/BannerWarning.js';
2
+ export { BreadcrumbList } from './components/Breadcrumb/index.js';
3
+ export { ChatBot } from './components/ChatBot.js';
4
+ export { Login } from './components/Login.js';
5
+ export * from './components/tour/index.js';
6
+ export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect, } from './hooks/service-now.js';
7
+ export { titleEffect, useTitleEffect } from './hooks/title.js';
8
+ export { useEffectOnce } from './hooks/use-effect-once.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,OAAO,EACL,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,GAC/G,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { NavigationProps } from './StepNavigation.js';
3
+ interface StepContainerProps {
4
+ children: ReactNode;
5
+ stepKey: string;
6
+ title: string;
7
+ position: PointingArrowPosition;
8
+ customNavigation?: Omit<NavigationProps, 'stepKey'>;
9
+ }
10
+ export declare const StepContainer: ({ title, stepKey, customNavigation, position, children }: StepContainerProps) => import("react/jsx-runtime").JSX.Element;
11
+ export type PointingArrowPosition = 'right' | 'top' | 'left' | 'bottom';
12
+ export {};
13
+ //# sourceMappingURL=StepContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepContainer.d.ts","sourceRoot":"","sources":["../../../src/components/tour/StepContainer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,eAAe,EAAkB,MAAM,kBAAkB,CAAA;AAIlE,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,qBAAqB,CAAC;IAChC,gBAAgB,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,aAAa,6DAA8D,kBAAkB,4CAOzG,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { theme } from '@stack-spot/portal-theme';
3
+ import { styled } from 'styled-components';
4
+ import { StepNavigation } from './StepNavigation.js';
5
+ import { StepTitle } from './StepTitle.js';
6
+ import { useTour } from './context.js';
7
+ export const StepContainer = ({ title, stepKey, customNavigation, position, children }) => {
8
+ const { finishStep } = useTour();
9
+ return _jsxs(BoxWithPointingArrow, { "$position": position, children: [_jsx(StepTitle, { title: title, onClose: () => finishStep(stepKey) }), children, _jsx(StepNavigation, { stepKey: stepKey, ...(customNavigation || {}) })] });
10
+ };
11
+ const BoxWithPointingArrow = styled.div `
12
+ position: relative;
13
+ width: 100%;
14
+ background-color: ${theme.color.inverse[500]};
15
+ &::after {
16
+ content: '';
17
+ position: absolute;
18
+ border-width: 10px;
19
+ border-style: solid;
20
+ border-color: transparent;
21
+ margin-top: -5px;
22
+ border-right-color: ${theme.color.inverse[500]};
23
+ ${({ $position, $top }) => $position === 'right' ?
24
+ `
25
+ top: ${$top || '16px'};
26
+ left: -18px;
27
+ ` : ''}
28
+ ${({ $position, $right }) => $position === 'top' ?
29
+ `
30
+ bottom: 96%;
31
+ right: ${$right || '16px'};
32
+ transform: rotate(90deg);
33
+ ` : ''}
34
+ ${({ $position, $top }) => $position === 'left' ?
35
+ `
36
+ top: ${$top || '16px'};
37
+ right: -18px;
38
+ transform: rotate(180deg);
39
+ ` : ''}
40
+ ${({ $position, $right }) => $position === 'bottom' ?
41
+ `
42
+ top: -13px;
43
+ right: ${$right || '16px'};
44
+ transform: rotate(90deg);
45
+ ` : ''}
46
+ }
47
+ `;
48
+ //# sourceMappingURL=StepContainer.js.map