1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9730],{4505:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/unilinks/shopping/products/[sku]",function(){return n(890)}])},614:function(e,t,n){"use strict";n.d(t,{Z:function(){return g}});var i=n(5893),a=n(9008),o=n.n(a),r=n(7294),s=n(2770);let c=new class{async getProductMapping(e){try{let t=await fetch("/api/unified-link/mappings/products?identifier=".concat(encodeURIComponent(e)));if(!t.ok)return null;let n=await t.json();return n.success?n.data:null}catch(e){return null}}async getCollectionMapping(e){try{let t=await fetch("/api/unified-link/mappings/collections?identifier=".concat(encodeURIComponent(e)));if(!t.ok)return null;let n=await t.json();return n.success?n.data:null}catch(e){return null}}};function l(){let e=navigator.userAgent.toLowerCase();return/android/.test(e)&&!/windows phone/.test(e)?"android":/iphone|ipod/.test(e)&&!window.MSStream||/ipad/.test(e)&&!window.MSStream&&"ontouchend"in document?"ios":"web"}let d={app:{deeplink:"".concat(s.APP_CONFIG.uniLink.deeplink.home,"?type=commerce_home")},web:{shopify:"".concat(s.APP_CONFIG.shopify.home,"/collections/all")}},u={shopify:s.APP_CONFIG.shopify.home,deeplink:{productDetail:s.APP_CONFIG.uniLink.deeplink.productDetail,collection:s.APP_CONFIG.uniLink.deeplink.collection,home:s.APP_CONFIG.uniLink.deeplink.home}};function p(e,t){let n="".concat(u.shopify).concat(e);if(!t)return n;let i=e.includes("?");return"".concat(n).concat(i?"&":"?").concat(t)}function m(e,t,n){return e?n?{url:function(e,t){let n="type=commerce_product_detail&id=".concat(e),i=t?"".concat(n,"&").concat(t):n;return"".concat(u.deeplink.productDetail,"?").concat(i)}(e.productId,t),shouldOpenApp:!0}:{url:p(e.shopifyPath,t),shouldOpenApp:!1}:{url:n?d.app.deeplink:d.web.shopify,shouldOpenApp:n}}function h(e,t,n){return e&&e.shopifyPath?e.collectionId&&n?{url:function(e,t){let n="type=commerce_collection&id=".concat(e,"&alias=collectionId"),i=t?"".concat(n,"&").concat(t):n;return"".concat(u.deeplink.collection,"?").concat(i)}(e.collectionId,t),shouldOpenApp:!0}:{url:p(e.shopifyPath,t),shouldOpenApp:!1}:{url:n?d.app.deeplink:d.web.shopify,shouldOpenApp:n}}let f=s.APP_CONFIG.uniLink.requestTimeout,w=s.APP_CONFIG.http.retryDelay;var g=e=>{let{type:t,identifier:n,queryParams:a,pageTitle:d=s.APP_CONFIG.site.name,contextLabel:u=t}=e,[p,g]=(0,r.useState)(null),[x,k]=(0,r.useState)(!1),[b,y]=(0,r.useState)(!1),[v,j]=(0,r.useState)(null),[P,N]=(0,r.useState)("preparing");(0,r.useEffect)(()=>{k(function(){let e=l();return"android"===e||"ios"===e}()),y(!0)},[]);let _=(e,t)=>{let n=!1;N("attempting");let i=/safari/i.test(navigator.userAgent)&&!/chrome/i.test(navigator.userAgent),a=setTimeout(()=>{n||(N("failed"),setTimeout(()=>{window.location.href=t},i?0:w))},f),o=()=>{document.hidden&&(n=!0,clearTimeout(a))},r=()=>{n=!0,clearTimeout(a)};if(document.addEventListener("visibilitychange",o),window.addEventListener("blur",r),i&&"ios"===l()){let t=document.createElement("iframe");t.style.display="none",t.src=e,document.body.appendChild(t),setTimeout(()=>{document.body.removeChild(t)},500),setTimeout(()=>{n||(window.location.href=e)},100)}else window.location.href=e;setTimeout(()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("blur",r)},f+500)},A=async()=>{try{let e,i;let o=l(),r="android"===o||"ios"===o;if("product"===t){let t=await c.getProductMapping(n);e=m(t,a,r),i=m(t,a,!1).url}else{let t=await c.getCollectionMapping(n);e=h(t,a,r),i=h(t,a,!1).url}if(j({deeplink:e.url,shopify:i,shouldOpenApp:e.shouldOpenApp}),await new Promise(e=>setTimeout(e,w)),!("android"===o||"ios"===o)){window.location.href=i;return}let s=/safari/i.test(navigator.userAgent)&&!/chrome/i.test(navigator.userAgent)&&"ios"===o;if(s){let t=!1;N("attempting");let n=setTimeout(()=>{t||(N("failed"),window.location.href=i)},1500);try{window.location.href=e.url}catch(e){clearTimeout(n),window.location.href=i;return}let a=()=>{document.hidden&&(t=!0,clearTimeout(n))};document.addEventListener("visibilitychange",a),setTimeout(()=>{document.removeEventListener("visibilitychange",a)},f);return}e.shouldOpenApp?_(e.url,i):window.location.href=i}catch(e){console.error("[".concat(u,"] Redirect error:"),e),g(e instanceof Error?e.message:"Terjadi kesalahan saat memproses link")}};return(0,r.useEffect)(()=>{b&&A()},[b]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o(),{children:[(0,i.jsx)("meta",{charSet:"utf-8"}),(0,i.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}),(0,i.jsx)("meta",{httpEquiv:"Cache-Control",content:"no-cache, no-store, must-revalidate, private"}),(0,i.jsx)("meta",{httpEquiv:"Pragma",content:"no-cache"}),(0,i.jsx)("meta",{httpEquiv:"Expires",content:"0"}),(0,i.jsx)("title",{children:d})]}),(0,i.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-white p-4",children:(0,i.jsx)("div",{className:"text-center max-w-2xl w-full",children:p?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"text-red-500 mb-4",children:(0,i.jsx)("svg",{className:"w-16 h-16 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,i.jsx)("h1",{className:"text-xl font-semibold text-gray-800 mb
1-2",children:"Oops, Ada Kendala"}),(0,i.jsx)("p",{className:"text-gray-600 mb-4",children:p}),(0,i.jsx)("button",{className:"px-6 py-3 bg-orange-500 text-white rounded-lg shadow-md hover:bg-orange-600 transition",onClick:()=>window.history.back(),children:"Kembali"})]}):(0,i.jsxs)(i.Fragment,{children:["preparing"===P&&(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-orange-500 mx-auto mb-4"}),(0,i.jsx)("h1",{className:"text-xl font-semibold text-gray-800 mb-2",children:"Menyiapkan..."}),(0,i.jsx)("p",{className:"text-gray-600 text-sm",children:"Mohon tunggu sebentar"})]}),"attempting"===P&&v&&(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-orange-500 mx-auto mb-4"}),(0,i.jsx)("h1",{className:"text-xl font-semibold text-gray-800 mb-2",children:x?"Membuka aplikasi...":"Mengarahkan..."}),(0,i.jsx)("p",{className:"text-gray-600 text-sm mb-4",children:x?"Jika aplikasi tidak terbuka, akan otomatis dialihkan ke web":"Anda akan diarahkan ke ".concat("product"===t?"halaman produk":"k
1oleksi produk")})]}),"failed"===P&&v&&(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)("p",{className:"text-gray-600 text-sm mb-6",children:"Mengarahkan ke halaman web..."}),(0,i.jsx)("button",{className:"px-6 py-3 bg-orange-500 text-white rounded-lg shadow-md hover:bg-orange-600 transition",onClick:()=>window.location.href=v.shopify,children:"Buka di Browser"})]})]})})})]})}},890:function(e,t,n){"use strict";n.r(t);var i=n(5893),a=n(1163),o=n(7294),r=n(614);t.default=()=>{let e=(0,a.useRouter)(),[t,n]=(0,o.useState)(""),[s,c]=(0,o.useState)(""),[l,d]=(0,o.useState)(!1);return((0,o.useEffect)(()=>{if(e.isReady){let{sku:t}=e.query;if(!t){let n=e.pathname.match(/\/products\/\[sku\]/);if(n){let n=e.asPath.match(/\/products\/([^?]+)/);n&&n[1]&&(t=n[1])}}let i=e.asPath.split("?")[1]||"";if(!t||"string"!=typeof t){console.error("[ProductDetail] sku parameter is required");return}n(t),c(function(e){if(!e)return"";let t=new URLSearchParams(e);return t.toString()}(i)),d(!0)}},[e.isReady,e.query,e.asPath,e.pathname]),l&&t)?(0,i.jsx)(r.Z,{type:"product",identifier:t,queryParams:s,pageTitle:"Tentang Anak - Product",contextLabel:"ProductDetail"}):(0,i.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-white p-4",children:(0,i.jsx)("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-orange-500"})})}},1163:function(e,t,n){e.exports=n(6885)}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=4505)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.