@aws-amplify/ui-react-notifications 0.0.0-studio-e5b8195-20230912200241 → 0.0.0-test-delay-3b0be8c-20250107175849

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 (51) hide show
  1. package/dist/esm/components/InAppMessaging/Backdrop/Backdrop.mjs +9 -0
  2. package/dist/esm/components/InAppMessaging/Backdrop/withBackdrop.mjs +15 -0
  3. package/dist/esm/components/InAppMessaging/BannerMessage/BannerMessage.mjs +27 -0
  4. package/dist/esm/components/InAppMessaging/BannerMessage/constants.mjs +4 -0
  5. package/dist/esm/components/InAppMessaging/CloseIconButton/CloseIconButton.mjs +10 -0
  6. package/dist/esm/components/InAppMessaging/FullScreenMessage/FullScreenMessage.mjs +29 -0
  7. package/dist/esm/components/InAppMessaging/FullScreenMessage/constants.mjs +4 -0
  8. package/dist/esm/components/InAppMessaging/InAppMessageDisplay/InAppMessageDisplay.mjs +50 -0
  9. package/dist/esm/components/InAppMessaging/InAppMessageDisplay/handleMessageLinkAction.mjs +23 -0
  10. package/dist/esm/components/InAppMessaging/MessageLayout/MessageLayout.mjs +33 -0
  11. package/dist/esm/components/InAppMessaging/MessageLayout/constants.mjs +21 -0
  12. package/dist/esm/components/InAppMessaging/MessageLayout/utils.mjs +22 -0
  13. package/dist/esm/components/InAppMessaging/ModalMessage/ModalMessage.mjs +23 -0
  14. package/dist/esm/components/InAppMessaging/ModalMessage/constants.mjs +6 -0
  15. package/dist/esm/components/InAppMessaging/hooks/useMessageImage/types.mjs +9 -0
  16. package/dist/esm/components/InAppMessaging/hooks/useMessageImage/useMessageImage.mjs +40 -0
  17. package/dist/esm/components/InAppMessaging/hooks/useMessageProps/useMessageProps.mjs +33 -0
  18. package/dist/esm/components/InAppMessaging/hooks/useMessageProps/utils.mjs +62 -0
  19. package/dist/esm/components/InAppMessaging/withInAppMessaging/withInAppMessaging.mjs +13 -0
  20. package/dist/esm/index.mjs +3 -0
  21. package/dist/esm/version.mjs +3 -0
  22. package/dist/index.js +393 -1
  23. package/dist/styles.css +1175 -725
  24. package/dist/types/components/InAppMessaging/MessageLayout/constants.d.ts +6 -6
  25. package/dist/types/components/InAppMessaging/MessageLayout/utils.d.ts +1 -1
  26. package/dist/types/components/InAppMessaging/ModalMessage/constants.d.ts +1 -1
  27. package/dist/types/components/InAppMessaging/hooks/useMessageImage/useMessageImage.d.ts +2 -2
  28. package/dist/types/components/InAppMessaging/index.d.ts +1 -1
  29. package/dist/types/version.d.ts +1 -0
  30. package/package.json +14 -37
  31. package/dist/esm/components/InAppMessaging/Backdrop/Backdrop.js +0 -1
  32. package/dist/esm/components/InAppMessaging/Backdrop/withBackdrop.js +0 -1
  33. package/dist/esm/components/InAppMessaging/BannerMessage/BannerMessage.js +0 -1
  34. package/dist/esm/components/InAppMessaging/BannerMessage/constants.js +0 -1
  35. package/dist/esm/components/InAppMessaging/CloseIconButton/CloseIconButton.js +0 -1
  36. package/dist/esm/components/InAppMessaging/FullScreenMessage/FullScreenMessage.js +0 -1
  37. package/dist/esm/components/InAppMessaging/FullScreenMessage/constants.js +0 -1
  38. package/dist/esm/components/InAppMessaging/InAppMessageDisplay/InAppMessageDisplay.js +0 -1
  39. package/dist/esm/components/InAppMessaging/InAppMessageDisplay/handleMessageLinkAction.js +0 -1
  40. package/dist/esm/components/InAppMessaging/MessageLayout/MessageLayout.js +0 -1
  41. package/dist/esm/components/InAppMessaging/MessageLayout/constants.js +0 -1
  42. package/dist/esm/components/InAppMessaging/MessageLayout/utils.js +0 -1
  43. package/dist/esm/components/InAppMessaging/ModalMessage/ModalMessage.js +0 -1
  44. package/dist/esm/components/InAppMessaging/ModalMessage/constants.js +0 -1
  45. package/dist/esm/components/InAppMessaging/hooks/useMessageImage/types.js +0 -1
  46. package/dist/esm/components/InAppMessaging/hooks/useMessageImage/useMessageImage.js +0 -1
  47. package/dist/esm/components/InAppMessaging/hooks/useMessageProps/useMessageProps.js +0 -1
  48. package/dist/esm/components/InAppMessaging/hooks/useMessageProps/utils.js +0 -1
  49. package/dist/esm/components/InAppMessaging/withInAppMessaging/withInAppMessaging.js +0 -1
  50. package/dist/esm/index.js +0 -1
  51. package/dist/esm/node_modules/tslib/tslib.es6.js +0 -1
@@ -1,10 +1,10 @@
1
1
  export declare const BLOCK_CLASS = "amplify-inappmessaging-messagelayout";
2
- export declare const BUTTON_CLASS: string;
3
- export declare const CLOSE_BUTTON_CLASS: string;
4
- export declare const CONTENT_CLASS: string;
5
- export declare const HEADER_CLASS: string;
6
- export declare const IMAGE_CONTAINER_CLASS: string;
7
- export declare const TEXT_CONTAINER_CLASS: string;
2
+ export declare const BUTTON_CLASS = "amplify-inappmessaging-messagelayout__button";
3
+ export declare const CLOSE_BUTTON_CLASS = "amplify-inappmessaging-messagelayout__close-button";
4
+ export declare const CONTENT_CLASS = "amplify-inappmessaging-messagelayout__content";
5
+ export declare const HEADER_CLASS = "amplify-inappmessaging-messagelayout__header";
6
+ export declare const IMAGE_CONTAINER_CLASS = "amplify-inappmessaging-messagelayout__image-container";
7
+ export declare const TEXT_CONTAINER_CLASS = "amplify-inappmessaging-messagelayout__text-container";
8
8
  export declare const BODY_TEXT_TEST_ID = "inappmessaging-messagelayout-bodytext";
9
9
  export declare const BUTTON_GROUP_TEST_ID = "inappmessaging-messagelayout-buttongroup";
10
10
  export declare const CONTENT_TEST_ID = "inappmessaging-messagelayout-content";
@@ -10,4 +10,4 @@ import { MessageLayoutButtonModifier } from './types';
10
10
  *
11
11
  * @returns the modifier - either 'light' or 'dark'
12
12
  */
13
- export declare const getButtonModifier: (buttonStyles: MessageComponentStyles['primaryButton' | 'primaryButton'], defaultModifier?: MessageLayoutButtonModifier) => MessageLayoutButtonModifier;
13
+ export declare const getButtonModifier: (buttonStyles: MessageComponentStyles['primaryButton' | 'secondaryButton'], defaultModifier?: MessageLayoutButtonModifier) => MessageLayoutButtonModifier;
@@ -1,2 +1,2 @@
1
1
  export declare const BLOCK_CLASS = "amplify-inappmessaging-modalmessage";
2
- export declare const DIALOG_CLASS: string;
2
+ export declare const DIALOG_CLASS = "amplify-inappmessaging-modalmessage__dialog";
@@ -1,4 +1,4 @@
1
- import { MessageImage } from '@aws-amplify/ui-react-core-notifications';
1
+ import { InAppMessageImage } from '@aws-amplify/ui-react-core-notifications';
2
2
  import { UseMessageImage } from './types';
3
3
  /**
4
4
  * Handles prefetching for message images
@@ -6,4 +6,4 @@ import { UseMessageImage } from './types';
6
6
  * @param image contains image source
7
7
  * @returns message image dimensions and fetching related booleans
8
8
  */
9
- export default function useMessageImage(image: MessageImage | undefined): UseMessageImage;
9
+ export default function useMessageImage(image: InAppMessageImage | undefined): UseMessageImage;
@@ -1,4 +1,4 @@
1
- export { InAppMessagingProvider, useInAppMessaging, } from '@aws-amplify/ui-react-core-notifications';
1
+ export { InAppMessage, InAppMessageAction, InAppMessageButton, InAppMessageContent, InAppMessageImage, InAppMessageLayout, InAppMessagingProvider, InAppMessageStyle, InAppMessageTextAlign, useInAppMessaging, } from '@aws-amplify/ui-react-core-notifications';
2
2
  export { BannerMessageProps } from './BannerMessage';
3
3
  export { FullScreenMessageProps } from './FullScreenMessage';
4
4
  export { InAppMessageDisplay, MessageComponents } from './InAppMessageDisplay';
@@ -0,0 +1 @@
1
+ export declare const VERSION = "2.1.1";
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-notifications",
3
- "version": "0.0.0-studio-e5b8195-20230912200241",
3
+ "version": "0.0.0-test-delay-3b0be8c-20250107175849",
4
4
  "main": "dist/index.js",
5
- "module": "dist/esm/index.js",
5
+ "module": "dist/esm/index.mjs",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./dist/types/index.d.ts",
9
- "import": "./dist/esm/index.js",
9
+ "import": "./dist/esm/index.mjs",
10
10
  "require": "./dist/index.js"
11
11
  },
12
12
  "./styles.css": "./dist/styles.css"
@@ -31,50 +31,27 @@
31
31
  "check:esm": "node --input-type=module --eval 'import \"@aws-amplify/ui-react-notifications\"'",
32
32
  "clean": "rimraf dist node_modules",
33
33
  "dev": "yarn build:rollup --watch",
34
- "lint": "yarn typecheck && eslint src --ext .js,.ts,.tsx",
34
+ "lint": "yarn typecheck && eslint .",
35
35
  "prebuild": "rimraf dist",
36
36
  "size": "yarn size-limit",
37
37
  "test": "jest",
38
- "test:ci": "yarn test",
39
38
  "test:watch": "yarn test --watch",
40
39
  "typecheck": "tsc --noEmit"
41
40
  },
42
41
  "dependencies": {
43
- "@aws-amplify/ui": "0.0.0-studio-e5b8195-20230912200241",
44
- "@aws-amplify/ui-react": "0.0.0-studio-e5b8195-20230912200241",
45
- "@aws-amplify/ui-react-core-notifications": "0.0.0-studio-e5b8195-20230912200241",
46
- "classnames": "2.3.1",
42
+ "@aws-amplify/ui": "0.0.0-test-delay-3b0be8c-20250107175849",
43
+ "@aws-amplify/ui-react": "0.0.0-test-delay-3b0be8c-20250107175849",
44
+ "@aws-amplify/ui-react-core": "0.0.0-test-delay-3b0be8c-20250107175849",
45
+ "@aws-amplify/ui-react-core-notifications": "0.0.0-test-delay-3b0be8c-20250107175849",
47
46
  "tinycolor2": "1.4.2"
48
47
  },
49
48
  "peerDependencies": {
50
- "aws-amplify": "^5.0.1",
51
- "react": ">= 16.14.0",
52
- "react-dom": ">= 16.14.0"
49
+ "aws-amplify": "^6.9.0",
50
+ "react": "^16.14.0 || ^17.0 || ^18.0",
51
+ "react-dom": "^16.14.0 || ^17.0 || ^18.0"
53
52
  },
54
53
  "devDependencies": {
55
- "@aws-amplify/eslint-config-amplify-ui": "0.0.0",
56
- "@rollup/plugin-commonjs": "^22.0.1",
57
- "@rollup/plugin-typescript": "^8.3.1",
58
- "@size-limit/preset-big-lib": "^8.2.6",
59
- "@testing-library/jest-dom": "^5.14.1",
60
- "@testing-library/react": "^12.0.0",
61
- "@testing-library/react-hooks": "^7.0.1",
62
- "@testing-library/user-event": "^13.2.1",
63
- "@types/jest": "^26.0.23",
64
- "@types/react": "^17.0.2",
65
- "@types/testing-library__jest-dom": "^5.14.1",
66
- "@types/tinycolor2": "^1.4.3",
67
- "eslint": "^8.44.0",
68
- "jest": "^27.0.4",
69
- "react": "^17.0.2",
70
- "react-dom": "^17.0.2",
71
- "rimraf": "^3.0.2",
72
- "rollup": "^2.70.0",
73
- "rollup-plugin-node-externals": "^4.1.1",
74
- "rollup-plugin-styles": "^4.0.0",
75
- "rollup-plugin-terser": "^7.0.2",
76
- "size-limit": "^8.2.6",
77
- "ts-jest": "^27.0.3"
54
+ "@types/tinycolor2": "^1.4.3"
78
55
  },
79
56
  "sideEffects": [
80
57
  "dist/**/*.css"
@@ -82,9 +59,9 @@
82
59
  "size-limit": [
83
60
  {
84
61
  "name": "InAppMessaging",
85
- "path": "dist/esm/index.js",
62
+ "path": "dist/esm/index.mjs",
86
63
  "import": "{ InAppMessagingProvider, InAppMessageDisplay }",
87
- "limit": "110 kB"
64
+ "limit": "23 kB"
88
65
  }
89
66
  ]
90
67
  }
@@ -1 +0,0 @@
1
- import{__rest as a}from"../../../node_modules/tslib/tslib.es6.js";import i from"react";import{View as t}from"@aws-amplify/ui-react";const e="inappmessaging-backdrop";function o(o){var{onClick:s}=o,r=a(o,["onClick"]);return i.createElement(t,Object.assign({className:"amplify-inappmessaging-backdrop","data-testid":e,onClick:s},r))}export{e as BACKDROP_TEST_ID,o as Backdrop};
@@ -1 +0,0 @@
1
- import e from"react";import{Flex as t,View as a}from"@aws-amplify/ui-react";import{Backdrop as n}from"./Backdrop.js";function r(r,c={}){return function(m){return e.createElement(e.Fragment,null,e.createElement(n,Object.assign({},c)),e.createElement(t,{className:"amplify-inappmessaging-backdrop-content-container"},e.createElement(a,{className:"amplify-inappmessaging-backdrop-content"},e.createElement(r,Object.assign({},m)))))}}export{r as withBackdrop};
@@ -1 +0,0 @@
1
- import e from"react";import s from"classnames";import{useBreakpointValue as t,Flex as o}from"@aws-amplify/ui-react";import"../hooks/useMessageImage/useMessageImage.js";import a from"../hooks/useMessageProps/useMessageProps.js";import{MessageLayout as r}from"../MessageLayout/MessageLayout.js";import{BLOCK_CLASS as i}from"./constants.js";function n(n){const m=a(n),l=t([!0,!0,!1]),{shouldRenderMessage:g,styles:p}=m;if(!g)return null;const{alignment:u="right",position:c="top"}=n,d="center"===u&&"middle"===c;return e.createElement(o,{className:s(i,{[`${i}--${c}`]:!d,[`${i}--${u}`]:!d,[`${i}--center-middle`]:d,[`${i}--full-width`]:l}),role:"dialog",testId:`inappmessaging-${c}banner-dialog`},e.createElement(r,Object.assign({},n,m,{orientation:"horizontal",buttonSize:"small",styles:p})))}export{n as BannerMessage};
@@ -1 +0,0 @@
1
- const a="amplify-inappmessaging-bannermessage";export{a as BLOCK_CLASS};
@@ -1 +0,0 @@
1
- import{__rest as e}from"../../../node_modules/tslib/tslib.es6.js";import*as s from"react";import{Button as a}from"@aws-amplify/ui-react";import{IconClose as i}from"@aws-amplify/ui-react/internal";function t(t){var{className:r,dismissButtonLabel:l="Dismiss message",onClick:m,style:o}=t,n=e(t,["className","dismissButtonLabel","onClick","style"]);return s.createElement(a,Object.assign({ariaLabel:l,className:r,onClick:m,style:o,variation:"link"},n),s.createElement(i,{"aria-hidden":"true",size:"1.5rem"}))}export{t as CloseIconButton};
@@ -1 +0,0 @@
1
- import*as e from"react";import s from"classnames";import{useBreakpointValue as o,Flex as r}from"@aws-amplify/ui-react";import{withBackdrop as t}from"../Backdrop/withBackdrop.js";import"../hooks/useMessageImage/useMessageImage.js";import a from"../hooks/useMessageProps/useMessageProps.js";import{MessageLayout as n}from"../MessageLayout/MessageLayout.js";import{BLOCK_CLASS as l}from"./constants.js";function m(m){const i=a(m),c=o([!0,!0,!1]),{shouldRenderMessage:u,styles:p}=i,{onClose:g}=m;if(!u)return null;const f=()=>e.createElement(r,{className:s(l,{[`${l}--fullscreen`]:c}),role:"dialog",testId:"inappmessaging-fullscreen-dialog"},e.createElement(n,Object.assign({},m,i,{styles:p})));if(c)return e.createElement(f,null);const d=t(f,{onClick:g});return e.createElement(d,null)}export{m as FullScreenMessage};
@@ -1 +0,0 @@
1
- const e="amplify-inappmessaging-fullscreenmessage";export{e as BLOCK_CLASS};
@@ -1 +0,0 @@
1
- import e from"react";import{useMessage as s,handleMessageAction as a}from"@aws-amplify/ui-react-core-notifications";import{ThemeProvider as o}from"@aws-amplify/ui-react";import{BannerMessage as n}from"../BannerMessage/BannerMessage.js";import{FullScreenMessage as r}from"../FullScreenMessage/FullScreenMessage.js";import{ModalMessage as t}from"../ModalMessage/ModalMessage.js";import i from"./handleMessageLinkAction.js";function l(e){return null}const c={BannerMessage:n,CarouselMessage:l,FullScreenMessage:r,ModalMessage:t},M=({action:e,url:s})=>{a({action:e,url:s,handleMessageLinkAction:i})};function m({components:a}){const n=e.useMemo((()=>Object.assign(Object.assign({},c),a)),[a]),{Component:r,props:t}=s({components:n,onMessageAction:M});return e.createElement(o,{colorMode:"light"},e.createElement(r,Object.assign({},t)))}m.BannerMessage=n,m.CarouselMessage=l,m.FullScreenMessage=r,m.ModalMessage=t;export{m as default};
@@ -1 +0,0 @@
1
- import{ConsoleLogger as o}from"@aws-amplify/core";const t=new o("Notifications.InAppMessaging"),r=o=>{let r;try{r=new URL(o)}catch(r){return void t.warn(`Unsupported url provided: ${o}`)}const{protocol:p}=r;"http:"===p||"https:"===p?window.open(o):t.warn(`Unsupported url protocol provided: ${p}`)};export{r as default};
@@ -1 +0,0 @@
1
- import*as e from"react";import t from"classnames";import{isEmpty as a}from"@aws-amplify/ui";import{Flex as n,Image as s,Heading as o,Text as r,ButtonGroup as l,Button as c}from"@aws-amplify/ui-react";import{CloseIconButton as m}from"../CloseIconButton/CloseIconButton.js";import{CLOSE_BUTTON_CLASS as i,BLOCK_CLASS as d,MESSAGE_LAYOUT_TEST_ID as y,CONTENT_CLASS as u,CONTENT_TEST_ID as p,IMAGE_CONTAINER_CLASS as f,IMAGE_CONTAINER_TEST_ID as E,TEXT_CONTAINER_CLASS as I,TEXT_CONTAINER_TEST_ID as $,HEADER_CLASS as B,HEADER_TEXT_TEST_ID as N,BODY_TEXT_TEST_ID as C,BUTTON_GROUP_TEST_ID as g,BUTTON_CLASS as v,SECONDARY_BUTTON_TEST_ID as b,PRIMARY_BUTTON_TEST_ID as h}from"./constants.js";import{getButtonModifier as j}from"./utils.js";const k=e=>!a(e);function x({body:a,buttonSize:x,hasRenderableImage:z,header:A,image:w,onClose:M,orientation:R="vertical",primaryButton:S,secondaryButton:T,styles:q}){const D=e.useMemo((()=>({primary:j(q.primaryButton),secondary:j(q.secondaryButton)})),[q]),F="horizontal"===R,G=e.createElement(m,{className:i,onClick:M,style:q.closeIconButton}),H=k(S),J=k(T),K=H||J;return e.createElement(n,{className:d,"data-testid":y,style:q.container},!F&&e.createElement(n,{justifyContent:"flex-end"},G),e.createElement(n,{className:t(u,`${u}--${R}`),"data-testid":p},z&&e.createElement(n,{className:t(f,`${f}--${R}`),"data-testid":E},e.createElement(s,{alt:"In-App Message Image",src:null==w?void 0:w.src,style:q.image})),e.createElement(n,{className:t(I,`${I}--${R}`),"data-testid":$},(null==A?void 0:A.content)&&e.createElement(o,{className:B,isTruncated:!0,level:2,style:q.header,testId:N},A.content),(null==a?void 0:a.content)&&e.createElement(r,{style:q.body,testId:C},a.content)),F&&e.createElement(n,{alignItems:"flex-start"},G)),K&&e.createElement(l,{size:x,testId:g},J&&e.createElement(c,{className:t(v,`${v}--${D.secondary}`),onClick:T.onAction,style:q.secondaryButton,testId:b},T.title),H&&e.createElement(c,{className:t(v,`${v}--${D.primary}`),onClick:S.onAction,style:q.primaryButton,testId:h},S.title)))}export{x as MessageLayout};
@@ -1 +0,0 @@
1
- const a="amplify-inappmessaging-messagelayout",e=`${a}__button`,s=`${a}__close-button`,n=`${a}__content`,t=`${a}__header`,g=`${a}__image-container`,i=`${a}__text-container`,o="inappmessaging-messagelayout-bodytext",m="inappmessaging-messagelayout-buttongroup",p="inappmessaging-messagelayout-content",u="inappmessaging-messagelayout-headertext",y="inappmessaging-messagelayout-imagecontainer",l="inappmessaging-messagelayout",_="inappmessaging-messagelayout-primarybutton",r="inappmessaging-messagelayout-secondarybutton",c="inappmessaging-messagelayout-textcontainer";export{a as BLOCK_CLASS,o as BODY_TEXT_TEST_ID,e as BUTTON_CLASS,m as BUTTON_GROUP_TEST_ID,s as CLOSE_BUTTON_CLASS,n as CONTENT_CLASS,p as CONTENT_TEST_ID,t as HEADER_CLASS,u as HEADER_TEXT_TEST_ID,g as IMAGE_CONTAINER_CLASS,y as IMAGE_CONTAINER_TEST_ID,l as MESSAGE_LAYOUT_TEST_ID,_ as PRIMARY_BUTTON_TEST_ID,r as SECONDARY_BUTTON_TEST_ID,i as TEXT_CONTAINER_CLASS,c as TEXT_CONTAINER_TEST_ID};
@@ -1 +0,0 @@
1
- import r from"tinycolor2";const o=(o,t="light")=>{const{backgroundColor:n}=null!=o?o:{};if(!n)return t;return r(n).isDark()?"dark":"light"};export{o as getButtonModifier};
@@ -1 +0,0 @@
1
- import*as s from"react";import e from"classnames";import{useBreakpointValue as a,Flex as o}from"@aws-amplify/ui-react";import"../hooks/useMessageImage/useMessageImage.js";import t from"../hooks/useMessageProps/useMessageProps.js";import{MessageLayout as r}from"../MessageLayout/MessageLayout.js";import{BLOCK_CLASS as m,DIALOG_CLASS as l}from"./constants.js";function i(i){const n=t(i),g=a([!0,!0,!1]),{shouldRenderMessage:p,styles:c}=n;return p?s.createElement(o,{className:m},s.createElement(o,{className:e(l,{[`${l}--full-width`]:g}),role:"dialog",testId:"inappmessaging-modal-dialog"},s.createElement(r,Object.assign({},i,n,{styles:c})))):null}export{i as ModalMessage};
@@ -1 +0,0 @@
1
- const a="amplify-inappmessaging-modalmessage",s=`${a}__dialog`;export{a as BLOCK_CLASS,s as DIALOG_CLASS};
@@ -1 +0,0 @@
1
- var e;!function(e){e.Aborted="ABORTED",e.Failure="FAILURE",e.Fetching="FETCHING",e.Success="SUCCESS"}(e||(e={}));export{e as ImagePrefetchStatus};
@@ -1 +0,0 @@
1
- import{useState as e,useEffect as r}from"react";import{ConsoleLogger as o}from"@aws-amplify/core";import{ImagePrefetchStatus as t}from"./types.js";const a=new o("Notifications.InAppMessaging");function n(o){const{src:n}=null!=o?o:{},s=!!n,[c,i]=e(s?t.Fetching:null),l=c===t.Fetching,m=c===t.Success;return r((()=>{if(!s)return;const e=new Image;e.onload=()=>{i(t.Success)},e.onabort=()=>{a.error(`Image load aborted: ${n}`),i(t.Aborted)},e.onerror=()=>{a.error(`Image failed to load: ${n}`),i(t.Failure)},e.src=n}),[s,n]),{hasRenderableImage:m,isImageFetching:l}}export{n as default};
@@ -1 +0,0 @@
1
- import{useRef as e,useEffect as s,useMemo as a}from"react";import r from"../useMessageImage/useMessageImage.js";import{getMessageStyles as t,getPayloadStyle as l}from"./utils.js";function o(o){const{image:m,onDisplay:n}=o,g=e(!1),{hasRenderableImage:i,isImageFetching:u}=r(m),c=!u;s((()=>{!g.current&&c&&(null==n||n(),g.current=!0)}),[n,c]);const d=a((()=>t({styleParams:{payloadStyle:l(o),overrideStyle:o.style}})),[o]);return{hasRenderableImage:i,shouldRenderMessage:c,styles:d}}export{o as default};
@@ -1 +0,0 @@
1
- const n=({body:n,container:o,header:l,primaryButton:t,secondaryButton:i})=>{var e,d,u,a,s;return{body:null!==(e=null==n?void 0:n.style)&&void 0!==e?e:{},container:null!==(d=null==o?void 0:o.style)&&void 0!==d?d:{},header:null!==(u=null==l?void 0:l.style)&&void 0!==u?u:{},primaryButton:null!==(a=null==t?void 0:t.style)&&void 0!==a?a:{},secondaryButton:null!==(s=null==i?void 0:i.style)&&void 0!==s?s:{}}};function o({styleParams:n}){var o,l;const{payloadStyle:t,overrideStyle:i}=n;return{body:Object.assign(Object.assign({},null==t?void 0:t.body),null==i?void 0:i.body),closeIconButton:null!==(o=null==i?void 0:i.closeIconButton)&&void 0!==o?o:{},container:Object.assign(Object.assign({},null==t?void 0:t.container),null==i?void 0:i.container),header:Object.assign(Object.assign({},null==t?void 0:t.header),null==i?void 0:i.header),image:null!==(l=null==i?void 0:i.image)&&void 0!==l?l:{},primaryButton:Object.assign(Object.assign({},null==t?void 0:t.primaryButton),null==i?void 0:i.primaryButton),secondaryButton:Object.assign(Object.assign({},null==t?void 0:t.secondaryButton),null==i?void 0:i.secondaryButton)}}export{o as getMessageStyles,n as getPayloadStyle};
@@ -1 +0,0 @@
1
- import e from"react";import{InAppMessagingProvider as t}from"@aws-amplify/ui-react-core-notifications";import r from"../InAppMessageDisplay/InAppMessageDisplay.js";function a(a,n){return function(i){return e.createElement(t,null,e.createElement(r,Object.assign({},n)),e.createElement(a,Object.assign({},i)))}}export{a as default};
package/dist/esm/index.js DELETED
@@ -1 +0,0 @@
1
- export{InAppMessagingProvider,useInAppMessaging}from"@aws-amplify/ui-react-core-notifications";export{default as InAppMessageDisplay}from"./components/InAppMessaging/InAppMessageDisplay/InAppMessageDisplay.js";export{default as withInAppMessaging}from"./components/InAppMessaging/withInAppMessaging/withInAppMessaging.js";
@@ -1 +0,0 @@
1
- function e(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}export{e as __rest};