UNPKG

@noaignite/react-centra-checkout

Version:

React components and helpers for Centra checkout api

1 lines 1.13 kB
{"version":3,"sources":["../src/ShipwalletEmbed.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useCentraSelection } from './Context'\nimport { HtmlEmbed } from './internal/HtmlEmbed'\n\nexport function ShipwalletEmbed() {\n const { selection } = useCentraSelection()\n\n useEffect(() => {\n if ('CentraCheckout' in window) {\n // we need to re init the shipwallet if the centra checkout script was loaded before the ingrid embed\n window.CentraCheckout?.reInitiate('shipwallet')\n }\n }, [])\n\n if (!selection?.pluginFields?.shipwallet?.snippet) {\n return null\n }\n\n return (\n <HtmlEmbed html={selection.pluginFields.shipwallet.snippet} id=\"centra-shipwallet-snippet\" />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAC1B,qBAAmC;AACnC,uBAA0B;AAiBtB;AAfG,SAAS,kBAAkB;AAChC,QAAM,EAAE,UAAU,QAAI,mCAAmB;AAEzC,8BAAU,MAAM;AACd,QAAI,oBAAoB,QAAQ;AAE9B,aAAO,gBAAgB,WAAW,YAAY;AAAA,IAChD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC,WAAW,cAAc,YAAY,SAAS;AACjD,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,8BAAU,MAAM,UAAU,aAAa,WAAW,SAAS,IAAG,6BAA4B;AAE/F;","names":[]}