Plugin Directory

Changeset 3408534


Ignore:
Timestamp:
12/02/2025 09:57:38 PM (11 days ago)
Author:
neosinner
Message:

Release 1.0.1

Location:
snapchat-for-woocommerce
Files:
40 edited
1 copied

Legend:

Unmodified
Added
Removed
  • snapchat-for-woocommerce/tags/1.0.1/changelog.txt

    r3368691 r3408534  
    11***Snapchat for WooCommerce Changelog ***
     2
     32025-12-02 - version 1.0.1
     4* Add - Display an admin notice prompting users to uninstall the legacy Snapchat Pixel plugin if it is installed and active.
     5* Fix - Improve tracking by deduplicating events sent from Pixel and Conversion API.   
     6* Tweak - WooCommerce 10.3 compatibility.
     7* Tweak - WordPress 6.9 compatibility.
    28
    392025-09-26 - version 1.0.0
  • snapchat-for-woocommerce/tags/1.0.1/includes/Admin/Assets.php

    r3368691 r3408534  
    7575            'AdminData',
    7676            array(
    77                 'setupComplete'      => boolval( Options::get( OptionDefaults::ONBOARDING_STATUS ) === 'connected' ),
    78                 'status'             => Options::get( OptionDefaults::ONBOARDING_STATUS ),
    79                 'step'               => Options::get( OptionDefaults::ONBOARDING_STEP ),
    80                 'exportNonce'        => wp_create_nonce( 'export-nonce' ),
    81                 'isExportInProgress' => ServiceContainer::get( ServiceKey::PRODUCT_EXPORT_SERVICE )->job->is_job_in_progress( ProductExportService::ACTION_HOOK ),
    82                 'exportFileUrl'      => file_exists( $csv_path ) ? Options::get( OptionDefaults::EXPORT_FILE_URL ) : '',
    83                 'lastTimestamp'      => Helper::get_formatted_timestamp( Options::get( OptionDefaults::LAST_EXPORT_TIMESTAMP ) ),
    84                 'slug'               => 'snapwoo',
    85                 'pluginVersion'      => SNAPCHAT_FOR_WOOCOMMERCE_VERSION,
    86                 'adAccountId'        => Options::get( OptionDefaults::AD_ACCOUNT_ID ),
     77                'setupComplete'        => boolval( Options::get( OptionDefaults::ONBOARDING_STATUS ) === 'connected' ),
     78                'status'               => Options::get( OptionDefaults::ONBOARDING_STATUS ),
     79                'step'                 => Options::get( OptionDefaults::ONBOARDING_STEP ),
     80                'exportNonce'          => wp_create_nonce( 'export-nonce' ),
     81                'isExportInProgress'   => ServiceContainer::get( ServiceKey::PRODUCT_EXPORT_SERVICE )->job->is_job_in_progress( ProductExportService::ACTION_HOOK ),
     82                'exportFileUrl'        => file_exists( $csv_path ) ? Options::get( OptionDefaults::EXPORT_FILE_URL ) : '',
     83                'lastTimestamp'        => Helper::get_formatted_timestamp( Options::get( OptionDefaults::LAST_EXPORT_TIMESTAMP ) ),
     84                'slug'                 => 'snapwoo',
     85                'pluginVersion'        => SNAPCHAT_FOR_WOOCOMMERCE_VERSION,
     86                'adAccountId'          => Options::get( OptionDefaults::AD_ACCOUNT_ID ),
     87                'isLegacyPluginActive' => Helper::is_legacy_snapchat_plugin_active(),
    8788            )
    8889        );
  • snapchat-for-woocommerce/tags/1.0.1/includes/ServiceContainer.php

    r3368691 r3408534  
    122122                    new Admin\Onboarding(),
    123123                    new ProductMeta\ProductMetaFields(),
     124                    new Admin\Notices(),
    124125                );
    125126
  • snapchat-for-woocommerce/tags/1.0.1/includes/Tracking/ConversionEvent/PurchaseEvent.php

    r3368691 r3408534  
    9797            'event_name'       => self::ID,
    9898            'event_source_url' => $this->order->get_checkout_order_received_url(),
    99             'event_id'         => EventIdRegistry::get_purchase_id( $this->order->get_id() ),
     99            'event_id'         => EventIdRegistry::get_purchase_id(),
    100100            'user_data'        => array(),
    101101            'custom_data'      => array(
  • snapchat-for-woocommerce/tags/1.0.1/includes/Tracking/EventIdRegistry.php

    r3368691 r3408534  
    2323
    2424    /**
    25      * Returns a order key for the given purchase.
    26      *
    27      * Uses the WooCommerce order ID as the key.
     25     * Returns a unique event ID for the purchase event.
    2826     *
    2927     * @since 0.1.0
    3028     *
    31      * @param int $order_id The Order ID.
    32      *
    33      * @return string Order key.
     29     * @return string Unique event ID.
    3430     */
    35     public static function get_purchase_id( $order_id ): string {
    36         $order = wc_get_order( $order_id );
    37         return $order instanceof \WC_Order ? (string) $order->get_order_key() : '';
     31    public static function get_purchase_id(): string {
     32        static $purchase_event_id = null;
     33        if ( null === $purchase_event_id ) {
     34            $purchase_event_id = wp_generate_uuid4();
     35        }
     36        return $purchase_event_id;
    3837    }
    3938}
  • snapchat-for-woocommerce/tags/1.0.1/includes/Tracking/RemotePixelTracker.php

    r3368691 r3408534  
    217217        $order->save_meta_data();
    218218
    219         $order_key       = $order->get_order_key();
    220219        $total           = $order->get_total();
    221220        $currency        = $order->get_currency();
     
    244243        }
    245244
    246         $payload = array(
    247             'price'          => $total,
    248             'currency'       => $currency,
    249             'event_id'       => $order_key,
    250             'transaction_id' => $order_key,
    251             'item_ids'       => $item_ids,
    252             'item_category'  => implode( ', ', array_unique( $item_categories ) ),
    253             'number_items'   => $number_items,
    254             'integration'    => 'woocommerce-v1',
    255             'ip_address'     => UserIdentifier::add_ip_address(),
     245        $event_id = EventIdRegistry::get_purchase_id();
     246        $payload  = array(
     247            'price'           => $total,
     248            'currency'        => $currency,
     249            'event_id'        => $event_id,
     250            'client_dedup_id' => $event_id,
     251            'transaction_id'  => $order_id,
     252            'item_ids'        => $item_ids,
     253            'item_category'   => implode( ', ', array_unique( $item_categories ) ),
     254            'number_items'    => $number_items,
     255            'integration'     => 'woocommerce-v1',
     256            'ip_address'      => UserIdentifier::add_ip_address(),
    256257        );
    257258
  • snapchat-for-woocommerce/tags/1.0.1/includes/Utils/Helper.php

    r3368691 r3408534  
    214214        return $data;
    215215    }
     216
     217    /**
     218     * Checks if the legacy Snapchat plugin is active.
     219     *
     220     * @return bool True if the legacy Snapchat plugin is active, false otherwise.
     221     */
     222    public static function is_legacy_snapchat_plugin_active() {
     223        return is_plugin_active( 'snap-pixel-for-woocommerce/snapchat-pixel-for-woocommerce.php' ) || class_exists( 'snap_pixel' );
     224    }
    216225}
  • snapchat-for-woocommerce/tags/1.0.1/js/build/commons.js

    r3368691 r3408534  
    1 "use strict";(globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[223],{14:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={match:{url:"/snapchat/start"},wpOpenMenu:"toplevel_page_woocommerce-marketing"};function a(){return(0,c.useEffect)(()=>{window.wpNavMenuClassChange(n,n.match.url)})}},873:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getSettings",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui),t=s[a]();return{capiEnabled:t.capiEnabled,collectPii:t.collectPii,shouldTriggerExport:t.triggerExport,lastExportTimeStamp:t.lastExportTimeStamp,exportFileUrl:t.exportFileUrl,hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},1968:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(5703);const n=()=>(0,c.getSetting)("adminUrl")},2224:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8468),n=t(6087);const a=e=>{const s=(0,n.useRef)(e);return(0,c.isEqual)(s.current,e)||(s.current=e),s.current}},2482:(e,s,t)=>{t.d(s,{x:()=>p,A:()=>_});var c=t(7723),n=t(6942),a=t.n(n),o=t(8242),r=t(8771);const i=t.p+"images/js/src/images/logo/snapchat.svg",l=t.p+"images/js/src/images/logo/wp.svg";var d=t(790);const p={EMPTY:"empty",WPCOM:"wpcom",SNAPCHAT:"snapchat"},u=(0,d.jsx)("img",{src:i,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),h=(0,d.jsx)("img",{src:l,alt:(0,c.__)("WordPress.com Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),m={[p.EMPTY]:{},[p.WPCOM]:{icon:h,title:"WordPress.com"},[p.SNAPCHAT]:{icon:u,title:(0,c.__)("Snapchat","snapchat-for-woocommerce")}},f={center:!1,top:"sfw-account-card__styled--align-top"},w={...f,toDetail:"sfw-account-card__indicator--align-to-detail"};function _({className:e,disabled:s=!1,appearance:t=p.EMPTY,icon:c=m[t].icon,title:n=m[t].title,description:i=m[t].description,helper:l,alignIcon:u="center",indicator:h,alignIndicator:_="center",detail:x,expandedDetail:g=!1,actions:j,children:v,...A}){const N=a()("sfw-account-card",!!s&&"sfw-account-card--is-disabled",!!g&&"sfw-account-card--is-expanded-detail",e),b=a()("sfw-account-card__icon",f[u]),y=a()("sfw-account-card__indicator",w[_]);return(0,d.jsxs)(o.A.Card,{className:N,...A,children:[(0,d.jsx)(o.A.Card.Body,{children:(0,d.jsxs)("div",{className:"sfw-account-card__body-layout",children:[c&&(0,d.jsx)("div",{className:b,children:c}),(0,d.jsxs)("div",{className:"sfw-account-card__subject",children:[n&&(0,d.jsx)(r.A.Title,{className:"sfw-account-card__title",children:n}),i&&(0,d.jsx)("div",{className:"sfw-account-card__description",children:i}),l&&(0,d.jsx)("div",{className:"sfw-account-card__helper",children:l})]}),x&&(0,d.jsx)("div",{className:"sfw-account-card__detail",children:x}),h&&(0,d.jsx)("div",{className:y,children:h}),j&&(0,d.jsx)("div",{className:"sfw-account-card__actions",children:j})]})}),v]})}},3164:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",title:t,description:n}=e;return(0,c.jsxs)("header",{className:`sfw-step-content-header ${s}`,children:[(0,c.jsx)("h1",{children:t}),(0,c.jsx)("div",{className:"sfw-step-content-header__description",children:n})]})}},3666:(e,s,t)=>{t.d(s,{FN:()=>a,xP:()=>n});var c=t(6476);const n=()=>(0,c.getNewPath)(null,"/snapchat/setup",null),a=()=>(0,c.getNewPath)(null,"/snapchat/settings",null)},3704:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",...t}=e;return(0,c.jsx)("div",{className:`sfw-step-content-actions ${s}`,...t})}},3741:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(7723),a=t(790);const o=()=>(0,a.jsx)("div",{className:"sfw-app-spinner",role:"status","aria-label":(0,n.__)("Loading…","snapchat-for-woocommerce"),children:(0,a.jsx)(c.Spinner,{})})},4566:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6942),n=t.n(c),a=t(7723),o=t(6427),r=t(4848),i=t(790);const l=e=>{const{className:s}=e;return(0,i.jsxs)(o.Flex,{className:n()("sfw-connected-icon-label",s),align:"center",gap:1,children:[(0,i.jsx)(o.FlexItem,{children:(0,i.jsx)(r.A,{})}),(0,i.jsx)(o.FlexItem,{children:(0,a.__)("Connected","snapchat-for-woocommerce")})]})}},4790:(e,s,t)=>{t.d(s,{Ay:()=>w});var c=t(7723);function n(e){return"yes"!==e.active?"":"yes"===e.owner?e.email:(0,c.__)("Successfully connected through Jetpack","snapchat-for-woocommerce")}var a=t(2482),o=t(4566),r=t(790);const i=({jetpack:e})=>(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:n(e),indicator:(0,r.jsx)(o.A,{})});var l=t(3832),d=t(3905),p=t(6520),u=t(7892),h=t(5640),m=t(6599);const f=()=>{const{createNotice:e}=(0,h.A)(),s=d.nP?.setupComplete?"reconnect":"setup-snapchat",t={next_page_name:s},n=(0,l.addQueryArgs)(`${p.RV}/jetpack/connect`,t),[o,{loading:i,data:f}]=(0,m.A)({path:n});return(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:(0,c.__)("Required to connect with Snapchat","snapchat-for-woocommerce"),indicator:(0,r.jsx)(u.A,{isSecondary:!0,loading:i||f,eventName:"sfw_wordpress_account_connect_button_click",eventProps:{context:s},onClick:async()=>{try{const e=await o();window.location.href=e.url}catch(s){e("error",(0,c.__)("Unable to connect your WordPress.com account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,c.__)("Connect","snapchat-for-woocommerce")})})},w=({jetpack:e})=>"yes"===e.active?(0,r.jsx)(i,{jetpack:e}):(0,r.jsx)(f,{})},5640:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(7143);const n=()=>(0,c.useDispatch)("core/notices")},5659:(e,s,t)=>{t.d(s,{A:()=>u});var c=t(7723),n=t(6427),a=t(6476),o=t(7892),r=t(9457);const i=t.p+"images/js/src/images/logo/woocommerce.svg",l=t.p+"images/js/src/images/logo/snapchat-wide.svg";var d=t(3666),p=t(790);const u=()=>{const e=()=>{(0,a.getHistory)().replace((0,d.FN)())};return(0,p.jsxs)(r.A,{className:"sfw-onboarding-success-modal",onRequestClose:e,buttons:[(0,p.jsx)(o.A,{variant:"secondary",onClick:e,children:(0,c.__)("Close","snapchat-for-woocommerce")},"close")],children:[(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__logos",children:(0,p.jsxs)(n.Flex,{gap:6,align:"center",justify:"center",children:[(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:i,alt:(0,c.__)("WooCommerce Logo","snapchat-for-woocommerce"),width:"187.5"})}),(0,p.jsx)(n.FlexItem,{className:"sfw-onboarding-success-modal__logo-separator-line"}),(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:l,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"123"})})]})}),(0,p.jsxs)("div",{className:"sfw-onboarding-success-modal__content",children:[(0,p.jsx)("h2",{className:"sfw-onboarding-success-modal__title",children:(0,c.__)("You’ve successfully set up Snapchat for WooCommerce! 🎉","snapchat-for-woocommerce")}),(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__description",children:(0,c.__)("Your store is now connected to Snapchat. You can start running ads, track performance, and reach Snapchat users with your WooCommerce products.","snapchat-for-woocommerce")})]})]})}},6028:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(3741),n=t(8242),a=t(790);const o=()=>(0,a.jsx)(n.A.Card,{children:(0,a.jsx)(n.A.Card.Body,{children:(0,a.jsx)(c.A,{})})})},6474:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={"full-page":["woocommerce-admin-full-screen","is-wp-toolbar-disabled","sfw-full-page"],"full-content":["sfw-full-content"]};function a(e){(0,c.useEffect)(()=>{if(!n.hasOwnProperty(e))return;const s=document.body.classList,t=n[e].filter(e=>!s.contains(e));return s.add(...t),()=>{s.remove(...t)}},[e])}},6599:(e,s,t)=>{t.d(s,{A:()=>m});var c=t(6087),n=t(1455),a=t.n(n),o=t(2224);const r="START",i="FINISH",l="ERROR",d="RESET",p={loading:!1,error:void 0,data:void 0,response:void 0,options:void 0},u=(e,s)=>{switch(s.type){case r:return{...e,loading:!0,options:s.options};case i:return{...e,loading:!1,data:s.data,response:s.response,options:s.options};case l:return{...e,loading:!1,error:s.error,response:s.response,options:s.options};case d:return s.state}},h=e=>{const{parse:s=!0}=e;return s},m=(e,s=p)=>{const t=(0,o.A)(e),n={...p,...s},[m,f]=(0,c.useReducer)(u,n);return[(0,c.useCallback)(async e=>{const s={...t,...e};f({type:r,options:s});try{const e=await a()({...s,parse:!1}),t=e.clone(),c=t.json&&await t.json();return f({type:i,data:c,response:e,options:s}),h(s)?c:e}catch(e){if("fetch_error"===e.code)throw f({type:l,error:e,response:void 0,options:s}),e;const t=e;let c;try{const e=t.clone();c=e.json?await e.json():new Error("No content body in fetch response.")}catch(e){c=new Error("Error parsing response.")}throw f({type:l,error:c,response:t,options:s}),h(s)?c:t}},[t]),{...m,reset:e=>{f({type:d,state:{...n,...e}})}}]}},7401:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getJetpackAccount",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui);return{jetpack:s[a](),hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},7539:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(8687),a=t(790);const o=({title:e,backHref:s,helpButton:t,onBackButtonClick:o})=>(0,a.jsxs)("div",{className:"sfw-stepper-top-bar",children:[(0,a.jsx)(c.Link,{className:"components-button sfw-stepper-top-bar__back-button",href:s,type:"wc-admin",onClick:o,children:(0,a.jsx)(n.A,{})}),(0,a.jsx)("span",{className:"sfw-stepper-top-bar__title",children:e}),t]})},7792:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(9031),n=t(790);const a=({size:e=18})=>(0,n.jsx)(c.A,{className:"sfw-warning-icon",size:e})},7892:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6427),n=t(8846),a=t(6942),o=t.n(a),r=t(6473),i=t(790);const l=e=>{const{className:s,disabled:t,loading:a,eventName:l,eventProps:d,text:p,onClick:u=()=>{},...h}=e,m=t||a,f=["sfw-app-button",s];let w;return a&&(w=(0,i.jsx)(n.Spinner,{})),p&&(w=(0,i.jsxs)(i.Fragment,{children:[a&&(0,i.jsx)(n.Spinner,{}),p]}),h.icon&&f.push("sfw-app-button--icon-with-text"),"right"===h.iconPosition&&f.push("sfw-app-button--icon-position-right")),(0,i.jsx)(c.Button,{className:o()(...f),disabled:m,"aria-disabled":m,text:w,onClick:(...e)=>{l&&(0,r.Sf)(l,d),u(...e)},...h})}},7952:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6087),a=t(6520),o=t(7162),r=t(2224);const i=()=>((e,...s)=>{const{invalidateResolution:t}=(0,o.j)(),i=(0,r.A)(s),l=(0,n.useCallback)(()=>{t(e,i)},[t,e,i]);return(0,c.useSelect)(s=>{const{isResolving:t,hasFinishedResolution:c}=s(a.Ui),n=s(a.Ui)[e](...i);return{isResolving:t(e,i),hasFinishedResolution:c(e,i),data:n,invalidateResolution:l}},[l,e,i])})("getSetup")},8242:(e,s,t)=>{t.d(s,{A:()=>d});var c=t(6942),n=t.n(c),a=t(6427),o=t(790);var r=t(8771);const i=({size:e="",...s})=>(0,o.jsx)(a.Card,{...s,size:e});i.Body=e=>{const{className:s,...t}=e;return(0,o.jsx)(a.CardBody,{className:n()("sfw-section-card-body",s),...t})},i.Footer=e=>{const{children:s,...t}=e;return(0,o.jsx)(a.CardFooter,{className:"sfw-section-card-footer",...t,children:s})},i.Title=e=>{const{className:s,...t}=e;return(0,o.jsx)(r.A.Title,{className:n()("sfw-section-card-title",s),...t})};const l=({className:e,title:s,description:t,topContent:c,children:r,disabled:i,disabledLeft:l,verticalGap:d=6})=>{const p=n()("sfw-section",!!i&&"sfw-section--is-disabled",!!l&&"sfw-section--is-disabled-left",e);return(0,o.jsxs)("section",{className:p,children:[(0,o.jsxs)("header",{className:"sfw-section__header",children:[c&&(0,o.jsx)("p",{children:c}),s&&(0,o.jsx)("h1",{children:s}),t]}),(0,o.jsx)(a.Flex,{className:"sfw-section__body",direction:"column",gap:d,children:r})]})};l.Card=i;const d=l},8523:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6520),a=t(3905),o=t(7952);const r="getSnapchatAccount",i=()=>{const{data:e}=(0,o.A)(),s=e?.status===a.Dh.CONNECTED;return(0,c.useSelect)(e=>{const t=e(n.Ui),c=t[r]();return{status:c?.status,isConnected:c?.status===a.C5.CONNECTED&&s,hasFinishedResolution:t.hasFinishedResolution(r,[])}},[s])}},8771:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(6942),n=t.n(c),a=t(790);const o=e=>{const{className:s="",...t}=e;return(0,a.jsx)("div",{className:`sfw-subsection ${s}`,...t})};o.Title=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-title",s),...t})},o.Subtitle=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-subtitle",s),...t})},o.Body=e=>{const{children:s}=e;return(0,a.jsx)("div",{className:"sfw-subsection-body",children:s})},o.HelperText=e=>{const{className:s,children:t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-helper-text",s),children:t})};const r=o},9180:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(7723),n=t(4236),a=t(7892),o=t(790);const r=({eventContext:e})=>(0,o.jsxs)(a.A,{className:"sfw-help-icon-button",href:"https://woocommerce.com/document/snapchat-for-woocommerce/",target:"_blank",eventName:"sfw_help_click",eventProps:{context:e},children:[(0,o.jsx)(n.A,{}),(0,c.__)("Help","snapchat-for-woocommerce")]})},9370:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",children:t,...n}=e;return(0,c.jsx)("div",{className:`sfw-step-content ${s}`,...n,children:(0,c.jsx)("div",{className:"sfw-step-content__container",children:t})})}},9457:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(6427),n=t(6942),a=t.n(n),o=t(790);const r={auto:!1,visible:"swf-app-modal__styled--overflow-visible"},i=({className:e,overflow:s="auto",buttons:t=[],children:n,...i})=>{const l=a()("sfw-admin-page","sfw-app-modal",r[s],e);return(0,o.jsxs)(c.Modal,{className:l,...i,children:[n,t.length>=1&&(0,o.jsx)("div",{className:"sfw-app-modal__footer",children:t})]})}},9826:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8242),n=t(790);const a=({children:e})=>(0,n.jsx)(c.A,{className:"sfw-step-content-footer",verticalGap:10,children:e})},9956:(e,s,t)=>{t.d(s,{L4:()=>j,Ay:()=>y});var c=t(6476),n=t(8523),a=t(7723),o=t(7143),r=t(6087),i=t(7162),l=t(6520);const d="getSnapchatAccountDetails";var p=t(790);const u=()=>{const{org_name:e,ad_acc_id:s,ad_acc_name:t,pixel_id:c}=(()=>{const e=(0,i.j)(),s=(0,r.useCallback)(()=>{e.invalidateResolution(d,[])},[e]);return(0,o.useSelect)(e=>{const t=e(l.Ui);return{...t[d](),refetchSnapchatAccountDetails:s,hasFinishedResolution:t.hasFinishedResolution(d,[])}},[s])})();return(0,p.jsxs)("div",{className:"sfw-snapchat-account-details",children:[e&&(0,p.jsxs)("p",{children:[(0,a.__)("Organization:","snapchat-for-woocommerce")," ",e]}),s&&t&&(0,p.jsxs)("p",{children:[(0,a.__)("Ads Account:","snapchat-for-woocommerce")," ",t," (",s,")"]}),c&&(0,p.jsxs)("p",{children:[(0,a.__)("Pixel ID:","snapchat-for-woocommerce")," ",c]})]})};var h=t(7892),m=t(3832),f=t(6599),w=t(5640);const _=({text:e=(0,a.__)("Or, connect to a different Snapchat account","snapchat-for-woocommerce"),...s})=>{const[t,{loading:c}]=(()=>{const{createNotice:e,removeNotice:s}=(0,w.A)(),{disconnectSnapchatAccount:t}=(0,i.j)(),[c,n]=(0,r.useState)(!1),[o,{loading:d,data:p}]=function(e){const s=(0,r.useMemo)(()=>{const s={next_page_name:e};return{path:(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,s)}},[e]);return(0,f.A)(s)}("setup-snapchat");return[async()=>{const{notice:c}=await e("info",(0,a.__)("Connecting to a different Snapchat account, please wait…","snapchat-for-woocommerce"));n(!0);try{await t();const{url:e}=await o();e&&(window.location.href=e)}catch(t){s(c.id),e("error",(0,a.__)("Unable to connect to a different Snapchat account. Please try again later.","snapchat-for-woocommerce"))}finally{n(!1)}},{loading:c||d||p}]})();return(0,p.jsx)(h.A,{isLink:!0,disabled:c,text:e,eventName:"sfw_snapchat_account_connect_different_account_button_click",onClick:t,...s})};var x=t(2482),g=t(4566);const j=({hideAccountSwitch:e=!1,children:s})=>(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,description:(0,p.jsx)(u,{}),indicator:(0,p.jsx)(g.A,{}),actions:e?null:(0,p.jsx)(_,{isTertiary:!0}),children:s});var v=t(3905),A=t(3666);const N=(e,s)=>{const{createNotice:t}=(0,w.A)(),{fetchSnapchatAccount:n,fetchSetup:a}=(0,i.j)(),[o,d]=(0,r.useState)(!1),[p]=(0,f.A)({path:`${l.RV}/snapchat/config`,method:"POST",data:{id:e,products_token:s}});return{upsertSnapchatConfig:(0,r.useCallback)(async()=>{if(!e||!s)return!1;d(!0);try{await p({parse:!1})}catch(e){t("error",e.message)}await n(),await a(),(0,c.getHistory)().replace((0,A.xP)()),d(!1)},[t,p,n,a,e,s]),loading:o}},b=({disabled:e,configId:s,productsToken:t})=>{const{createNotice:c}=(0,w.A)(),{upsertSnapchatConfig:n,loading:o}=N(s,t),i=v.nP?.setupComplete?"reconnect":"setup-snapchat",d={next_page_name:i},u=(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,d),[_,{loading:g,data:j}]=(0,f.A)({path:u});(0,r.useEffect)(()=>{s&&n(s)},[s,t,n]);return(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,disabled:e,description:(0,a.__)("Connect your Snapchat Business Account to sync your catalog and run Dynamic Ads.","snapchat-for-woocommerce"),indicator:o?(0,p.jsx)(h.A,{loading:!0,text:(0,a.__)("Connecting…","snapchat-for-woocommerce")}):(0,p.jsx)(h.A,{isSecondary:!0,disabled:e,loading:g||j,eventName:"sfw_snapchat_account_connect_button_click",eventProps:{context:i},onClick:async()=>{try{const e=await _();window.location.href=e.url}catch(e){c("error",(0,a.__)("Unable to connect your Snapchat account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,a.__)("Connect","snapchat-for-woocommerce")})})},y=({disabled:e=!1})=>{const{isConnected:s}=(0,n.A)(),{config_id:t,products_token:a}=(0,c.getQuery)();return s?(0,p.jsx)(j,{}):(0,p.jsx)(b,{disabled:e,configId:t,productsToken:a})}}}]);
     1"use strict";(globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[223],{14:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={match:{url:"/snapchat/start"},wpOpenMenu:"toplevel_page_woocommerce-marketing"};function a(){return(0,c.useEffect)(()=>{window.wpNavMenuClassChange(n,n.match.url)})}},873:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getSettings",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui),t=s[a]();return{capiEnabled:t.capiEnabled,collectPii:t.collectPii,shouldTriggerExport:t.triggerExport,lastExportTimeStamp:t.lastExportTimeStamp,exportFileUrl:t.exportFileUrl,hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},1968:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(5703);const n=()=>(0,c.getSetting)("adminUrl")},2224:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8468),n=t(6087);const a=e=>{const s=(0,n.useRef)(e);return(0,c.isEqual)(s.current,e)||(s.current=e),s.current}},2465:(e,s,t)=>{t.d(s,{A:()=>u});var c=t(7723),n=t(6087),a=t(6427),o=t(3905),r=t(8846),i=t(6473),l=t(790);const d=e=>{const{eventName:s,eventProps:t,onClick:c=()=>{},...n}=e;return(0,l.jsx)(r.Link,{...n,onClick:e=>{s&&(0,i.Sf)(s,t),c(e)}})},p=e=>{const{context:s,linkId:t,href:c,...n}=e;return(0,l.jsx)(d,{eventProps:{context:s,link_id:t,href:c},type:"external",target:"_blank",href:c,...n,eventName:"sfw_documentation_link_click"})},u=()=>{const{isLegacyPluginActive:e}=o.nP;return e?(0,l.jsx)(a.Notice,{status:"warning",isDismissible:!1,children:(0,n.createInterpolateElement)((0,c.__)("You currently have two Snapchat plugins installed. Having both plugins active can cause reporting issues. Please uninstall the 'Snapchat Pixel for WooCommerce' (Legacy Plugin) by following the steps <link>here</link>.","snapchat-for-woocommerce"),{link:(0,l.jsx)(p,{context:"legacy-plugin-active-notice",linkId:"legacy-plugin-active-notice",href:"https://woocommerce.com/document/snapchat-for-woocommerce/#section-4"})})}):null}},2482:(e,s,t)=>{t.d(s,{x:()=>p,A:()=>_});var c=t(7723),n=t(6942),a=t.n(n),o=t(8242),r=t(8771);const i=t.p+"images/js/src/images/logo/snapchat.svg",l=t.p+"images/js/src/images/logo/wp.svg";var d=t(790);const p={EMPTY:"empty",WPCOM:"wpcom",SNAPCHAT:"snapchat"},u=(0,d.jsx)("img",{src:i,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),h=(0,d.jsx)("img",{src:l,alt:(0,c.__)("WordPress.com Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),m={[p.EMPTY]:{},[p.WPCOM]:{icon:h,title:"WordPress.com"},[p.SNAPCHAT]:{icon:u,title:(0,c.__)("Snapchat","snapchat-for-woocommerce")}},f={center:!1,top:"sfw-account-card__styled--align-top"},w={...f,toDetail:"sfw-account-card__indicator--align-to-detail"};function _({className:e,disabled:s=!1,appearance:t=p.EMPTY,icon:c=m[t].icon,title:n=m[t].title,description:i=m[t].description,helper:l,alignIcon:u="center",indicator:h,alignIndicator:_="center",detail:x,expandedDetail:g=!1,actions:j,children:v,...A}){const N=a()("sfw-account-card",!!s&&"sfw-account-card--is-disabled",!!g&&"sfw-account-card--is-expanded-detail",e),b=a()("sfw-account-card__icon",f[u]),y=a()("sfw-account-card__indicator",w[_]);return(0,d.jsxs)(o.A.Card,{className:N,...A,children:[(0,d.jsx)(o.A.Card.Body,{children:(0,d.jsxs)("div",{className:"sfw-account-card__body-layout",children:[c&&(0,d.jsx)("div",{className:b,children:c}),(0,d.jsxs)("div",{className:"sfw-account-card__subject",children:[n&&(0,d.jsx)(r.A.Title,{className:"sfw-account-card__title",children:n}),i&&(0,d.jsx)("div",{className:"sfw-account-card__description",children:i}),l&&(0,d.jsx)("div",{className:"sfw-account-card__helper",children:l})]}),x&&(0,d.jsx)("div",{className:"sfw-account-card__detail",children:x}),h&&(0,d.jsx)("div",{className:y,children:h}),j&&(0,d.jsx)("div",{className:"sfw-account-card__actions",children:j})]})}),v]})}},3164:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",title:t,description:n}=e;return(0,c.jsxs)("header",{className:`sfw-step-content-header ${s}`,children:[(0,c.jsx)("h1",{children:t}),(0,c.jsx)("div",{className:"sfw-step-content-header__description",children:n})]})}},3666:(e,s,t)=>{t.d(s,{FN:()=>a,xP:()=>n});var c=t(6476);const n=()=>(0,c.getNewPath)(null,"/snapchat/setup",null),a=()=>(0,c.getNewPath)(null,"/snapchat/settings",null)},3704:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",...t}=e;return(0,c.jsx)("div",{className:`sfw-step-content-actions ${s}`,...t})}},3741:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(7723),a=t(790);const o=()=>(0,a.jsx)("div",{className:"sfw-app-spinner",role:"status","aria-label":(0,n.__)("Loading…","snapchat-for-woocommerce"),children:(0,a.jsx)(c.Spinner,{})})},4566:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6942),n=t.n(c),a=t(7723),o=t(6427),r=t(4848),i=t(790);const l=e=>{const{className:s}=e;return(0,i.jsxs)(o.Flex,{className:n()("sfw-connected-icon-label",s),align:"center",gap:1,children:[(0,i.jsx)(o.FlexItem,{children:(0,i.jsx)(r.A,{})}),(0,i.jsx)(o.FlexItem,{children:(0,a.__)("Connected","snapchat-for-woocommerce")})]})}},4790:(e,s,t)=>{t.d(s,{Ay:()=>w});var c=t(7723);function n(e){return"yes"!==e.active?"":"yes"===e.owner?e.email:(0,c.__)("Successfully connected through Jetpack","snapchat-for-woocommerce")}var a=t(2482),o=t(4566),r=t(790);const i=({jetpack:e})=>(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:n(e),indicator:(0,r.jsx)(o.A,{})});var l=t(3832),d=t(3905),p=t(6520),u=t(7892),h=t(5640),m=t(6599);const f=()=>{const{createNotice:e}=(0,h.A)(),s=d.nP?.setupComplete?"reconnect":"setup-snapchat",t={next_page_name:s},n=(0,l.addQueryArgs)(`${p.RV}/jetpack/connect`,t),[o,{loading:i,data:f}]=(0,m.A)({path:n});return(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:(0,c.__)("Required to connect with Snapchat","snapchat-for-woocommerce"),indicator:(0,r.jsx)(u.A,{isSecondary:!0,loading:i||f,eventName:"sfw_wordpress_account_connect_button_click",eventProps:{context:s},onClick:async()=>{try{const e=await o();window.location.href=e.url}catch(s){e("error",(0,c.__)("Unable to connect your WordPress.com account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,c.__)("Connect","snapchat-for-woocommerce")})})},w=({jetpack:e})=>"yes"===e.active?(0,r.jsx)(i,{jetpack:e}):(0,r.jsx)(f,{})},5640:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(7143);const n=()=>(0,c.useDispatch)("core/notices")},5659:(e,s,t)=>{t.d(s,{A:()=>u});var c=t(7723),n=t(6427),a=t(6476),o=t(7892),r=t(9457);const i=t.p+"images/js/src/images/logo/woocommerce.svg",l=t.p+"images/js/src/images/logo/snapchat-wide.svg";var d=t(3666),p=t(790);const u=()=>{const e=()=>{(0,a.getHistory)().replace((0,d.FN)())};return(0,p.jsxs)(r.A,{className:"sfw-onboarding-success-modal",onRequestClose:e,buttons:[(0,p.jsx)(o.A,{variant:"secondary",onClick:e,children:(0,c.__)("Close","snapchat-for-woocommerce")},"close")],children:[(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__logos",children:(0,p.jsxs)(n.Flex,{gap:6,align:"center",justify:"center",children:[(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:i,alt:(0,c.__)("WooCommerce Logo","snapchat-for-woocommerce"),width:"187.5"})}),(0,p.jsx)(n.FlexItem,{className:"sfw-onboarding-success-modal__logo-separator-line"}),(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:l,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"123"})})]})}),(0,p.jsxs)("div",{className:"sfw-onboarding-success-modal__content",children:[(0,p.jsx)("h2",{className:"sfw-onboarding-success-modal__title",children:(0,c.__)("You’ve successfully set up Snapchat for WooCommerce! 🎉","snapchat-for-woocommerce")}),(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__description",children:(0,c.__)("Your store is now connected to Snapchat. You can start running ads, track performance, and reach Snapchat users with your WooCommerce products.","snapchat-for-woocommerce")})]})]})}},6028:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(3741),n=t(8242),a=t(790);const o=()=>(0,a.jsx)(n.A.Card,{children:(0,a.jsx)(n.A.Card.Body,{children:(0,a.jsx)(c.A,{})})})},6474:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={"full-page":["woocommerce-admin-full-screen","is-wp-toolbar-disabled","sfw-full-page"],"full-content":["sfw-full-content"]};function a(e){(0,c.useEffect)(()=>{if(!n.hasOwnProperty(e))return;const s=document.body.classList,t=n[e].filter(e=>!s.contains(e));return s.add(...t),()=>{s.remove(...t)}},[e])}},6599:(e,s,t)=>{t.d(s,{A:()=>m});var c=t(6087),n=t(1455),a=t.n(n),o=t(2224);const r="START",i="FINISH",l="ERROR",d="RESET",p={loading:!1,error:void 0,data:void 0,response:void 0,options:void 0},u=(e,s)=>{switch(s.type){case r:return{...e,loading:!0,options:s.options};case i:return{...e,loading:!1,data:s.data,response:s.response,options:s.options};case l:return{...e,loading:!1,error:s.error,response:s.response,options:s.options};case d:return s.state}},h=e=>{const{parse:s=!0}=e;return s},m=(e,s=p)=>{const t=(0,o.A)(e),n={...p,...s},[m,f]=(0,c.useReducer)(u,n);return[(0,c.useCallback)(async e=>{const s={...t,...e};f({type:r,options:s});try{const e=await a()({...s,parse:!1}),t=e.clone(),c=t.json&&await t.json();return f({type:i,data:c,response:e,options:s}),h(s)?c:e}catch(e){if("fetch_error"===e.code)throw f({type:l,error:e,response:void 0,options:s}),e;const t=e;let c;try{const e=t.clone();c=e.json?await e.json():new Error("No content body in fetch response.")}catch(e){c=new Error("Error parsing response.")}throw f({type:l,error:c,response:t,options:s}),h(s)?c:t}},[t]),{...m,reset:e=>{f({type:d,state:{...n,...e}})}}]}},7401:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getJetpackAccount",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui);return{jetpack:s[a](),hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},7539:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(8687),a=t(790);const o=({title:e,backHref:s,helpButton:t,onBackButtonClick:o})=>(0,a.jsxs)("div",{className:"sfw-stepper-top-bar",children:[(0,a.jsx)(c.Link,{className:"components-button sfw-stepper-top-bar__back-button",href:s,type:"wc-admin",onClick:o,children:(0,a.jsx)(n.A,{})}),(0,a.jsx)("span",{className:"sfw-stepper-top-bar__title",children:e}),t]})},7792:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(9031),n=t(790);const a=({size:e=18})=>(0,n.jsx)(c.A,{className:"sfw-warning-icon",size:e})},7892:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6427),n=t(8846),a=t(6942),o=t.n(a),r=t(6473),i=t(790);const l=e=>{const{className:s,disabled:t,loading:a,eventName:l,eventProps:d,text:p,onClick:u=()=>{},...h}=e,m=t||a,f=["sfw-app-button",s];let w;return a&&(w=(0,i.jsx)(n.Spinner,{})),p&&(w=(0,i.jsxs)(i.Fragment,{children:[a&&(0,i.jsx)(n.Spinner,{}),p]}),h.icon&&f.push("sfw-app-button--icon-with-text"),"right"===h.iconPosition&&f.push("sfw-app-button--icon-position-right")),(0,i.jsx)(c.Button,{className:o()(...f),disabled:m,"aria-disabled":m,text:w,onClick:(...e)=>{l&&(0,r.Sf)(l,d),u(...e)},...h})}},7952:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6087),a=t(6520),o=t(7162),r=t(2224);const i=()=>((e,...s)=>{const{invalidateResolution:t}=(0,o.j)(),i=(0,r.A)(s),l=(0,n.useCallback)(()=>{t(e,i)},[t,e,i]);return(0,c.useSelect)(s=>{const{isResolving:t,hasFinishedResolution:c}=s(a.Ui),n=s(a.Ui)[e](...i);return{isResolving:t(e,i),hasFinishedResolution:c(e,i),data:n,invalidateResolution:l}},[l,e,i])})("getSetup")},8242:(e,s,t)=>{t.d(s,{A:()=>d});var c=t(6942),n=t.n(c),a=t(6427),o=t(790);var r=t(8771);const i=({size:e="",...s})=>(0,o.jsx)(a.Card,{...s,size:e});i.Body=e=>{const{className:s,...t}=e;return(0,o.jsx)(a.CardBody,{className:n()("sfw-section-card-body",s),...t})},i.Footer=e=>{const{children:s,...t}=e;return(0,o.jsx)(a.CardFooter,{className:"sfw-section-card-footer",...t,children:s})},i.Title=e=>{const{className:s,...t}=e;return(0,o.jsx)(r.A.Title,{className:n()("sfw-section-card-title",s),...t})};const l=({className:e,title:s,description:t,topContent:c,children:r,disabled:i,disabledLeft:l,verticalGap:d=6})=>{const p=n()("sfw-section",!!i&&"sfw-section--is-disabled",!!l&&"sfw-section--is-disabled-left",e);return(0,o.jsxs)("section",{className:p,children:[(c||s||t)&&(0,o.jsxs)("header",{className:"sfw-section__header",children:[c&&(0,o.jsx)("p",{children:c}),s&&(0,o.jsx)("h1",{children:s}),t]}),(0,o.jsx)(a.Flex,{className:"sfw-section__body",direction:"column",gap:d,children:r})]})};l.Card=i;const d=l},8523:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6520),a=t(3905),o=t(7952);const r="getSnapchatAccount",i=()=>{const{data:e}=(0,o.A)(),s=e?.status===a.Dh.CONNECTED;return(0,c.useSelect)(e=>{const t=e(n.Ui),c=t[r]();return{status:c?.status,isConnected:c?.status===a.C5.CONNECTED&&s,hasFinishedResolution:t.hasFinishedResolution(r,[])}},[s])}},8771:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(6942),n=t.n(c),a=t(790);const o=e=>{const{className:s="",...t}=e;return(0,a.jsx)("div",{className:`sfw-subsection ${s}`,...t})};o.Title=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-title",s),...t})},o.Subtitle=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-subtitle",s),...t})},o.Body=e=>{const{children:s}=e;return(0,a.jsx)("div",{className:"sfw-subsection-body",children:s})},o.HelperText=e=>{const{className:s,children:t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-helper-text",s),children:t})};const r=o},9180:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(7723),n=t(4236),a=t(7892),o=t(790);const r=({eventContext:e})=>(0,o.jsxs)(a.A,{className:"sfw-help-icon-button",href:"https://woocommerce.com/document/snapchat-for-woocommerce/",target:"_blank",eventName:"sfw_help_click",eventProps:{context:e},children:[(0,o.jsx)(n.A,{}),(0,c.__)("Help","snapchat-for-woocommerce")]})},9370:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",children:t,...n}=e;return(0,c.jsx)("div",{className:`sfw-step-content ${s}`,...n,children:(0,c.jsx)("div",{className:"sfw-step-content__container",children:t})})}},9457:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(6427),n=t(6942),a=t.n(n),o=t(790);const r={auto:!1,visible:"swf-app-modal__styled--overflow-visible"},i=({className:e,overflow:s="auto",buttons:t=[],children:n,...i})=>{const l=a()("sfw-admin-page","sfw-app-modal",r[s],e);return(0,o.jsxs)(c.Modal,{className:l,...i,children:[n,t.length>=1&&(0,o.jsx)("div",{className:"sfw-app-modal__footer",children:t})]})}},9826:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8242),n=t(790);const a=({children:e})=>(0,n.jsx)(c.A,{className:"sfw-step-content-footer",verticalGap:10,children:e})},9956:(e,s,t)=>{t.d(s,{L4:()=>j,Ay:()=>y});var c=t(6476),n=t(8523),a=t(7723),o=t(7143),r=t(6087),i=t(7162),l=t(6520);const d="getSnapchatAccountDetails";var p=t(790);const u=()=>{const{org_name:e,ad_acc_id:s,ad_acc_name:t,pixel_id:c}=(()=>{const e=(0,i.j)(),s=(0,r.useCallback)(()=>{e.invalidateResolution(d,[])},[e]);return(0,o.useSelect)(e=>{const t=e(l.Ui);return{...t[d](),refetchSnapchatAccountDetails:s,hasFinishedResolution:t.hasFinishedResolution(d,[])}},[s])})();return(0,p.jsxs)("div",{className:"sfw-snapchat-account-details",children:[e&&(0,p.jsxs)("p",{children:[(0,a.__)("Organization:","snapchat-for-woocommerce")," ",e]}),s&&t&&(0,p.jsxs)("p",{children:[(0,a.__)("Ads Account:","snapchat-for-woocommerce")," ",t," (",s,")"]}),c&&(0,p.jsxs)("p",{children:[(0,a.__)("Pixel ID:","snapchat-for-woocommerce")," ",c]})]})};var h=t(7892),m=t(3832),f=t(6599),w=t(5640);const _=({text:e=(0,a.__)("Or, connect to a different Snapchat account","snapchat-for-woocommerce"),...s})=>{const[t,{loading:c}]=(()=>{const{createNotice:e,removeNotice:s}=(0,w.A)(),{disconnectSnapchatAccount:t}=(0,i.j)(),[c,n]=(0,r.useState)(!1),[o,{loading:d,data:p}]=function(e){const s=(0,r.useMemo)(()=>{const s={next_page_name:e};return{path:(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,s)}},[e]);return(0,f.A)(s)}("setup-snapchat");return[async()=>{const{notice:c}=await e("info",(0,a.__)("Connecting to a different Snapchat account, please wait…","snapchat-for-woocommerce"));n(!0);try{await t();const{url:e}=await o();e&&(window.location.href=e)}catch(t){s(c.id),e("error",(0,a.__)("Unable to connect to a different Snapchat account. Please try again later.","snapchat-for-woocommerce"))}finally{n(!1)}},{loading:c||d||p}]})();return(0,p.jsx)(h.A,{isLink:!0,disabled:c,text:e,eventName:"sfw_snapchat_account_connect_different_account_button_click",onClick:t,...s})};var x=t(2482),g=t(4566);const j=({hideAccountSwitch:e=!1,children:s})=>(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,description:(0,p.jsx)(u,{}),indicator:(0,p.jsx)(g.A,{}),actions:e?null:(0,p.jsx)(_,{isTertiary:!0}),children:s});var v=t(3905),A=t(3666);const N=(e,s)=>{const{createNotice:t}=(0,w.A)(),{fetchSnapchatAccount:n,fetchSetup:a}=(0,i.j)(),[o,d]=(0,r.useState)(!1),[p]=(0,f.A)({path:`${l.RV}/snapchat/config`,method:"POST",data:{id:e,products_token:s}});return{upsertSnapchatConfig:(0,r.useCallback)(async()=>{if(!e||!s)return!1;d(!0);try{await p({parse:!1})}catch(e){t("error",e.message)}await n(),await a(),(0,c.getHistory)().replace((0,A.xP)()),d(!1)},[t,p,n,a,e,s]),loading:o}},b=({disabled:e,configId:s,productsToken:t})=>{const{createNotice:c}=(0,w.A)(),{upsertSnapchatConfig:n,loading:o}=N(s,t),i=v.nP?.setupComplete?"reconnect":"setup-snapchat",d={next_page_name:i},u=(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,d),[_,{loading:g,data:j}]=(0,f.A)({path:u});(0,r.useEffect)(()=>{s&&n(s)},[s,t,n]);return(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,disabled:e,description:(0,a.__)("Connect your Snapchat Business Account to sync your catalog and run Dynamic Ads.","snapchat-for-woocommerce"),indicator:o?(0,p.jsx)(h.A,{loading:!0,text:(0,a.__)("Connecting…","snapchat-for-woocommerce")}):(0,p.jsx)(h.A,{isSecondary:!0,disabled:e,loading:g||j,eventName:"sfw_snapchat_account_connect_button_click",eventProps:{context:i},onClick:async()=>{try{const e=await _();window.location.href=e.url}catch(e){c("error",(0,a.__)("Unable to connect your Snapchat account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,a.__)("Connect","snapchat-for-woocommerce")})})},y=({disabled:e=!1})=>{const{isConnected:s}=(0,n.A)(),{config_id:t,products_token:a}=(0,c.getQuery)();return s?(0,p.jsx)(j,{}):(0,p.jsx)(b,{disabled:e,configId:t,productsToken:a})}}}]);
  • snapchat-for-woocommerce/tags/1.0.1/js/build/index.asset.php

    r3368691 r3408534  
    1 <?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wc-components', 'wc-navigation', 'wc-settings', 'wc-tracks', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-url'), 'version' => '60bfb8bebe7e0268daeb');
     1<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wc-components', 'wc-navigation', 'wc-settings', 'wc-tracks', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-url'), 'version' => '64ba4abdecf54c10414f');
  • snapchat-for-woocommerce/tags/1.0.1/js/build/index.js

    r3368691 r3408534  
    1 (()=>{"use strict";var e,t,n={790:e=>{e.exports=window.ReactJSXRuntime},1455:e=>{e.exports=window.wp.apiFetch},1609:e=>{e.exports=window.React},3832:e=>{e.exports=window.wp.url},3905:(e,t,n)=>{n.d(t,{C5:()=>a,Dh:()=>r,nP:()=>o});const o=window.snapchatAdsAdminData,a={CONNECTED:"connected",DISCONNECTED:"disconnected"},r={CONNECTED:"connected",DISCONNECTED:"disconnected"}},5703:e=>{e.exports=window.wc.wcSettings},6087:e=>{e.exports=window.wp.element},6427:e=>{e.exports=window.wp.components},6473:(e,t,n)=>{n.d(t,{qX:()=>p,Rv:()=>d,Sf:()=>u,T:()=>i});var o=n(7143),a=n(8468);const r=window.wc.tracks;var c=n(3905),s=n(7162);const i=a.noop;function p(e){const{slug:t}=c.nP,{version:n,adAccountId:a}=(0,o.select)(s.U).getGeneral(),r={...e,[`${t}_version`]:n};return a&&(r[`${t}_ads_id`]=a),r}function u(e,t){(0,r.recordEvent)(e,p(t))}function d(e,t){(0,r.queueRecordEvent)(e,p(t))}},6476:e=>{e.exports=window.wc.navigation},6520:(e,t,n)=>{n.d(t,{RV:()=>a,Ui:()=>o,mY:()=>r});const o="wc/sfw",a="/wc/sfw",r="core/notices"},7143:e=>{e.exports=window.wp.data},7162:(e,t,n)=>{n.d(t,{U:()=>i.Ui,j:()=>L});var o={};n.r(o),n.d(o,{disconnectSnapchatAccount:()=>A,fetchSetup:()=>T,fetchSnapchatAccount:()=>S,receiveJetpackAccount:()=>m,receiveSettings:()=>f,receiveSetup:()=>C,receiveSnapchatAccount:()=>E,receiveSnapchatAccountDetails:()=>g,receiveTrackConversionsStatus:()=>_,updateSettings:()=>w});var a={};n.r(a),n.d(a,{getGeneral:()=>y,getJetpackAccount:()=>N,getSettings:()=>O,getSetup:()=>v,getSnapchatAccount:()=>b,getSnapchatAccountDetails:()=>I});var r={};n.r(r),n.d(r,{getJetpackAccount:()=>P,getSettings:()=>x,getSetup:()=>V,getSnapchatAccount:()=>R,getSnapchatAccountDetails:()=>U});var c=n(7143),s=n(3905),i=n(6520),p=n(7723),u=n(1455),d=n.n(u);function l(e,t,n){if(401!==e?.statusCode){const o=function(e,t,n){const o=[],a=e?.message;return t&&o.push(t),a&&"string"==typeof a?o.push(a):n&&o.push(n),0===o.length&&o.push((0,p.__)("Unknown error occurred.","snapchat-for-woocommerce")),o.join((0,p._x)(" ","The spacing between sentences. It's a space in English. Please use an empty string if no spacing is needed in that language.","snapchat-for-woocommerce"))}(e,t,n);(0,c.dispatch)(i.mY).createNotice("error",o)}console.error(e)}const h={RECEIVE_ACCOUNTS_JETPACK:"RECEIVE_ACCOUNTS_JETPACK",RECEIVE_SNAPCHAT_ACCOUNT:"RECEIVE_SNAPCHAT_ACCOUNT",RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:"RECEIVE_SNAPCHAT_ACCOUNT_DETAILS",RECEIVE_TRACK_CONVERSIONS_STATUS:"RECEIVE_TRACK_CONVERSIONS_STATUS",RECEIVE_SETUP:"RECEIVE_SETUP",RECEIVE_SETTINGS:"RECEIVE_SETTINGS",DISCONNECT_ACCOUNTS_SNAPCHAT:"DISCONNECT_ACCOUNTS_SNAPCHAT",DISCONNECT_ACCOUNTS_ALL:"DISCONNECT_ACCOUNTS_ALL"};function m(e){return{type:h.RECEIVE_ACCOUNTS_JETPACK,account:e}}function E(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT,snapchatAccount:e}}function _(e){return{type:h.RECEIVE_TRACK_CONVERSIONS_STATUS,status:e}}function C(e){return{type:h.RECEIVE_SETUP,setup:e}}function f(e){return{type:h.RECEIVE_SETTINGS,settings:e}}function g(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS,snapchatAccountDetails:e}}async function w(e){try{const t=await d()({path:`${i.RV}/snapchat/settings`,method:"POST",data:{capi_enabled:e.capiEnabled,collect_pii:e.collectPii}});return f({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url})}catch(e){throw l(e,(0,p.__)("There was an error updating the settings.","snapchat-for-woocommerce")),e}}async function S(){try{const e=await d()({path:`${i.RV}/snapchat/connection`});(0,c.dispatch)(i.Ui).receiveSnapchatAccount(e)}catch(e){l(e,(0,p.__)("There was an error loading Snapchat account info.","snapchat-for-woocommerce"))}}async function T(){try{const e=await d()({path:`${i.RV}/snapchat/setup`});(0,c.dispatch)(i.Ui).receiveSetup(e)}catch(e){l(e,(0,p.__)("There was an error loading Snapchat setup.","snapchat-for-woocommerce"))}}async function A(e=!1){try{return await d()({path:`${i.RV}/snapchat/connection`,method:"DELETE"}),{type:h.DISCONNECT_ACCOUNTS_SNAPCHAT,invalidateRelatedState:e}}catch(e){throw l(e,(0,p.__)("Unable to disconnect your Snapchat account.","snapchat-for-woocommerce")),e}}const v=e=>e.setup,N=e=>e.accounts.jetpack,b=e=>e.accounts.snapchat,y=e=>e.general,I=e=>e.snapchat,O=e=>e.settings;function P(){return async function({dispatch:e}){try{e(m(await d()({path:`${i.RV}/jetpack/connected`})))}catch(e){l(e,(0,p.__)("There was an error loading Jetpack account info.","snapchat-for-woocommerce"))}}}function R(){return S}function U(){return async function({dispatch:e}){try{e(g(await d()({path:`${i.RV}/snapchat/account`})))}catch(e){l(e,(0,p.__)("There was an error loading Snapchat account details info.","snapchat-for-woocommerce"))}}}function x(){return async function({dispatch:e}){try{const t=await d()({path:`${i.RV}/snapchat/settings`});e(f({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url}))}catch(e){l(e,(0,p.__)("There was an error fetching settings.","snapchat-for-woocommerce"))}}}function V(){return T}var k=n(8468);function D(e,t,n){return function(e,t=""){const n=Object.assign(e.constructor(),e),o=e=>null==e?{}:(0,k.clone)(e);return{setIn(e,a){const r=(e=>t?Array.isArray(t)||Array.isArray(e)?[].concat(t,e):`${t}.${e}`:e)(e);return(0,k.setWith)(n,r,a,o),this},end:()=>n}}(e).setIn(t,n).end()}const j=(0,c.createReduxStore)(i.Ui,{actions:o,selectors:a,resolvers:r,reducer:(e,t)=>{switch(t.type){case h.RECEIVE_ACCOUNTS_JETPACK:{const{account:n}=t;return D(e,"accounts.jetpack",n)}case h.RECEIVE_SETUP:{const{setup:n}=t;return D(e,"setup",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT:{const{snapchatAccount:n}=t;return D(e,"accounts.snapchat",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:{const{snapchatAccountDetails:n}=t;return D(e,"snapchat",n)}case h.DISCONNECT_ACCOUNTS_SNAPCHAT:return D(e,"accounts.snapchat",null);case h.RECEIVE_SETTINGS:{const{settings:n}=t;return D(e,"settings",n)}case h.DISCONNECT_ACCOUNTS_ALL:default:return e}},initialState:{general:{version:s.nP.pluginVersion,adAccountId:s.nP.adAccountId},setup:{status:s.nP.status,step:s.nP.step},accounts:{jetpack:null,snapchat:null},snapchat:null,settings:{capiEnabled:!1,collectPii:!0,triggerExport:!1,lastExportTimeStamp:"",exportFileUrl:""}}});(0,c.register)(j);const L=()=>(0,c.useDispatch)(i.Ui)},7723:e=>{e.exports=window.wp.i18n},8468:e=>{e.exports=window.lodash},8846:e=>{e.exports=window.wc.components}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>({207:"get-started-page",223:"commons",352:"onboarding",472:"settings"}[e]+".js?ver="+{207:"dd28af6dd94cd7e7cfae",223:"28ee55793c55b7ee94b6",352:"e1bd35623cbd93fc707d",472:"fd1f8446e705b19d4dd6"}[e]),a.miniCssF=e=>({352:"onboarding",472:"settings"}[e]+".css?ver="+{352:"e1bd35623cbd93fc707d",472:"fd1f8446e705b19d4dd6"}[e]),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="snapchat-for-woocommerce:",a.l=(n,o,r,c)=>{if(e[n])e[n].push(o);else{var s,i;if(void 0!==r)for(var p=document.getElementsByTagName("script"),u=0;u<p.length;u++){var d=p[u];if(d.getAttribute("src")==n||d.getAttribute("data-webpack")==t+r){s=d;break}}s||(i=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",t+r),s.src=n),e[n]=[o];var l=(t,o)=>{s.onerror=s.onload=null,clearTimeout(h);var a=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),a&&a.forEach(e=>e(o)),t)return t(o)},h=setTimeout(l.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=l.bind(null,s.onerror),s.onload=l.bind(null,s.onload),i&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{if("undefined"!=typeof document){var e={57:0};a.f.miniCss=(t,n)=>{e[t]?n.push(e[t]):0!==e[t]&&{352:1,472:1}[t]&&n.push(e[t]=(e=>new Promise((t,n)=>{var o=a.miniCssF(e),r=a.p+o;if(((e,t)=>{for(var n=document.getElementsByTagName("link"),o=0;o<n.length;o++){var a=(c=n[o]).getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(a===e||a===t))return c}var r=document.getElementsByTagName("style");for(o=0;o<r.length;o++){var c;if((a=(c=r[o]).getAttribute("data-href"))===e||a===t)return c}})(o,r))return t();((e,t,n,o,r)=>{var c=document.createElement("link");c.rel="stylesheet",c.type="text/css",a.nc&&(c.nonce=a.nc),c.onerror=c.onload=n=>{if(c.onerror=c.onload=null,"load"===n.type)o();else{var a=n&&n.type,s=n&&n.target&&n.target.href||t,i=new Error("Loading CSS chunk "+e+" failed.\n("+a+": "+s+")");i.name="ChunkLoadError",i.code="CSS_CHUNK_LOAD_FAILED",i.type=a,i.request=s,c.parentNode&&c.parentNode.removeChild(c),r(i)}},c.href=t,document.head.appendChild(c)})(e,r,0,t,n)}))(t).then(()=>{e[t]=0},n=>{throw delete e[t],n}))}}})(),(()=>{var e={57:0};a.f.j=(t,n)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise((n,a)=>o=e[t]=[n,a]);n.push(o[2]=r);var c=a.p+a.u(t),s=new Error;a.l(c,n=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),c=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+r+": "+c+")",s.name="ChunkLoadError",s.type=r,s.request=c,o[1](s)}},"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[c,s,i]=n,p=0;if(c.some(t=>0!==e[t])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);i&&i(a)}for(t&&t(n);p<c.length;p++)r=c[p],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=a(7723),c=a(6087);const s=window.wp.hooks;var i=a(5703);a(7162);const p=window.wp.compose;var u=a(790);const d=(0,p.createHigherOrderComponent)(e=>t=>(0,u.jsx)("div",{className:"sfw-admin-page",children:(0,u.jsx)(e,{...t})}),"withAdminPageShell");var l=a(6473);const h=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(207)]).then(a.bind(a,9484))),m=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(352)]).then(a.bind(a,8481))),E=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(472)]).then(a.bind(a,8052))),_=new Set,C=(0,i.getSetting)("admin")?.woocommerceTranslation||(0,r.__)("WooCommerce","snapchat-for-woocommerce"),f="woocommerce_admin_pages_list";let g=!1;const w=()=>{(0,s.addFilter)(f,"woocommerce/snapchat-for-woo/add-page-routes",e=>{const t=[["",C],["/marketing",(0,r.__)("Marketing","snapchat-for-woocommerce")],(0,r.__)("Snapchat for WooCommerce","snapchat-for-woocommerce")],n=[{breadcrumbs:[...t],container:h,path:"/snapchat/start",wpOpenMenu:"toplevel_page_woocommerce-marketing"},{breadcrumbs:[...t,(0,r.__)("Setup Snapchat","snapchat-for-woocommerce")],container:m,path:"/snapchat/setup"},{breadcrumbs:[...t,(0,r.__)("Settings","snapchat-for-woocommerce")],container:E,path:"/snapchat/settings",wpOpenMenu:"toplevel_page_woocommerce-marketing"}];return n.forEach(e=>{e.container=d(e.container);const t=e.path.substring(1).replace(/\//g,"_");_.add(t)}),g=!0,e.concat(n)})},S=()=>(0,s.hasAction)("hookAdded",`woocommerce/woocommerce/watch_${f}`);if((0,s.didFilter)(f)>0&&!S()&&!g){const e=Date.now(),t=setInterval(()=>{if(S())return clearInterval(t),void w();Date.now()-e>3e3&&clearInterval(t)},10)}else w();(0,s.addFilter)("woocommerce_tracks_client_event_properties","woocommerce/snapchat-for-woo/add-base-event-properties-to-page-view",(e,t)=>"wcadmin_page_view"===t&&_.has(e.path)?(0,l.qX)(e):e)})();
     1(()=>{"use strict";var e,t,n={790:e=>{e.exports=window.ReactJSXRuntime},1455:e=>{e.exports=window.wp.apiFetch},1609:e=>{e.exports=window.React},3832:e=>{e.exports=window.wp.url},3905:(e,t,n)=>{n.d(t,{C5:()=>a,Dh:()=>r,nP:()=>o});const o=window.snapchatAdsAdminData,a={CONNECTED:"connected",DISCONNECTED:"disconnected"},r={CONNECTED:"connected",DISCONNECTED:"disconnected"}},5703:e=>{e.exports=window.wc.wcSettings},6087:e=>{e.exports=window.wp.element},6427:e=>{e.exports=window.wp.components},6473:(e,t,n)=>{n.d(t,{qX:()=>p,Rv:()=>l,Sf:()=>u,T:()=>i});var o=n(7143),a=n(8468);const r=window.wc.tracks;var c=n(3905),s=n(7162);const i=a.noop;function p(e){const{slug:t}=c.nP,{version:n,adAccountId:a}=(0,o.select)(s.U).getGeneral(),r={...e,[`${t}_version`]:n};return a&&(r[`${t}_ads_id`]=a),r}function u(e,t){(0,r.recordEvent)(e,p(t))}function l(e,t){(0,r.queueRecordEvent)(e,p(t))}},6476:e=>{e.exports=window.wc.navigation},6520:(e,t,n)=>{n.d(t,{RV:()=>a,Ui:()=>o,mY:()=>r});const o="wc/sfw",a="/wc/sfw",r="core/notices"},7143:e=>{e.exports=window.wp.data},7162:(e,t,n)=>{n.d(t,{U:()=>i.Ui,j:()=>L});var o={};n.r(o),n.d(o,{disconnectSnapchatAccount:()=>A,fetchSetup:()=>T,fetchSnapchatAccount:()=>S,receiveJetpackAccount:()=>m,receiveSettings:()=>C,receiveSetup:()=>_,receiveSnapchatAccount:()=>f,receiveSnapchatAccountDetails:()=>g,receiveTrackConversionsStatus:()=>E,updateSettings:()=>w});var a={};n.r(a),n.d(a,{getGeneral:()=>y,getJetpackAccount:()=>N,getSettings:()=>O,getSetup:()=>v,getSnapchatAccount:()=>b,getSnapchatAccountDetails:()=>I});var r={};n.r(r),n.d(r,{getJetpackAccount:()=>P,getSettings:()=>x,getSetup:()=>V,getSnapchatAccount:()=>R,getSnapchatAccountDetails:()=>U});var c=n(7143),s=n(3905),i=n(6520),p=n(7723),u=n(1455),l=n.n(u);function d(e,t,n){if(401!==e?.statusCode){const o=function(e,t,n){const o=[],a=e?.message;return t&&o.push(t),a&&"string"==typeof a?o.push(a):n&&o.push(n),0===o.length&&o.push((0,p.__)("Unknown error occurred.","snapchat-for-woocommerce")),o.join((0,p._x)(" ","The spacing between sentences. It's a space in English. Please use an empty string if no spacing is needed in that language.","snapchat-for-woocommerce"))}(e,t,n);(0,c.dispatch)(i.mY).createNotice("error",o)}console.error(e)}const h={RECEIVE_ACCOUNTS_JETPACK:"RECEIVE_ACCOUNTS_JETPACK",RECEIVE_SNAPCHAT_ACCOUNT:"RECEIVE_SNAPCHAT_ACCOUNT",RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:"RECEIVE_SNAPCHAT_ACCOUNT_DETAILS",RECEIVE_TRACK_CONVERSIONS_STATUS:"RECEIVE_TRACK_CONVERSIONS_STATUS",RECEIVE_SETUP:"RECEIVE_SETUP",RECEIVE_SETTINGS:"RECEIVE_SETTINGS",DISCONNECT_ACCOUNTS_SNAPCHAT:"DISCONNECT_ACCOUNTS_SNAPCHAT",DISCONNECT_ACCOUNTS_ALL:"DISCONNECT_ACCOUNTS_ALL"};function m(e){return{type:h.RECEIVE_ACCOUNTS_JETPACK,account:e}}function f(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT,snapchatAccount:e}}function E(e){return{type:h.RECEIVE_TRACK_CONVERSIONS_STATUS,status:e}}function _(e){return{type:h.RECEIVE_SETUP,setup:e}}function C(e){return{type:h.RECEIVE_SETTINGS,settings:e}}function g(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS,snapchatAccountDetails:e}}async function w(e){try{const t=await l()({path:`${i.RV}/snapchat/settings`,method:"POST",data:{capi_enabled:e.capiEnabled,collect_pii:e.collectPii}});return C({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url})}catch(e){throw d(e,(0,p.__)("There was an error updating the settings.","snapchat-for-woocommerce")),e}}async function S(){try{const e=await l()({path:`${i.RV}/snapchat/connection`});(0,c.dispatch)(i.Ui).receiveSnapchatAccount(e)}catch(e){d(e,(0,p.__)("There was an error loading Snapchat account info.","snapchat-for-woocommerce"))}}async function T(){try{const e=await l()({path:`${i.RV}/snapchat/setup`});(0,c.dispatch)(i.Ui).receiveSetup(e)}catch(e){d(e,(0,p.__)("There was an error loading Snapchat setup.","snapchat-for-woocommerce"))}}async function A(e=!1){try{return await l()({path:`${i.RV}/snapchat/connection`,method:"DELETE"}),{type:h.DISCONNECT_ACCOUNTS_SNAPCHAT,invalidateRelatedState:e}}catch(e){throw d(e,(0,p.__)("Unable to disconnect your Snapchat account.","snapchat-for-woocommerce")),e}}const v=e=>e.setup,N=e=>e.accounts.jetpack,b=e=>e.accounts.snapchat,y=e=>e.general,I=e=>e.snapchat,O=e=>e.settings;function P(){return async function({dispatch:e}){try{e(m(await l()({path:`${i.RV}/jetpack/connected`})))}catch(e){d(e,(0,p.__)("There was an error loading Jetpack account info.","snapchat-for-woocommerce"))}}}function R(){return S}function U(){return async function({dispatch:e}){try{e(g(await l()({path:`${i.RV}/snapchat/account`})))}catch(e){d(e,(0,p.__)("There was an error loading Snapchat account details info.","snapchat-for-woocommerce"))}}}function x(){return async function({dispatch:e}){try{const t=await l()({path:`${i.RV}/snapchat/settings`});e(C({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url}))}catch(e){d(e,(0,p.__)("There was an error fetching settings.","snapchat-for-woocommerce"))}}}function V(){return T}var k=n(8468);function D(e,t,n){return function(e,t=""){const n=Object.assign(e.constructor(),e),o=e=>null==e?{}:(0,k.clone)(e);return{setIn(e,a){const r=(e=>t?Array.isArray(t)||Array.isArray(e)?[].concat(t,e):`${t}.${e}`:e)(e);return(0,k.setWith)(n,r,a,o),this},end:()=>n}}(e).setIn(t,n).end()}const j=(0,c.createReduxStore)(i.Ui,{actions:o,selectors:a,resolvers:r,reducer:(e,t)=>{switch(t.type){case h.RECEIVE_ACCOUNTS_JETPACK:{const{account:n}=t;return D(e,"accounts.jetpack",n)}case h.RECEIVE_SETUP:{const{setup:n}=t;return D(e,"setup",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT:{const{snapchatAccount:n}=t;return D(e,"accounts.snapchat",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:{const{snapchatAccountDetails:n}=t;return D(e,"snapchat",n)}case h.DISCONNECT_ACCOUNTS_SNAPCHAT:return D(e,"accounts.snapchat",null);case h.RECEIVE_SETTINGS:{const{settings:n}=t;return D(e,"settings",n)}case h.DISCONNECT_ACCOUNTS_ALL:default:return e}},initialState:{general:{version:s.nP.pluginVersion,adAccountId:s.nP.adAccountId},setup:{status:s.nP.status,step:s.nP.step},accounts:{jetpack:null,snapchat:null},snapchat:null,settings:{capiEnabled:!1,collectPii:!0,triggerExport:!1,lastExportTimeStamp:"",exportFileUrl:""}}});(0,c.register)(j);const L=()=>(0,c.useDispatch)(i.Ui)},7723:e=>{e.exports=window.wp.i18n},8468:e=>{e.exports=window.lodash},8846:e=>{e.exports=window.wc.components}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>({207:"get-started-page",223:"commons",352:"onboarding",472:"settings"}[e]+".js?ver="+{207:"dd28af6dd94cd7e7cfae",223:"2c49a44dff67e815f1d7",352:"b44c93c3f7ac41effb6b",472:"1e0e847f8ffc27511c69"}[e]),a.miniCssF=e=>({352:"onboarding",472:"settings"}[e]+".css?ver="+{352:"b44c93c3f7ac41effb6b",472:"1e0e847f8ffc27511c69"}[e]),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="snapchat-for-woocommerce:",a.l=(n,o,r,c)=>{if(e[n])e[n].push(o);else{var s,i;if(void 0!==r)for(var p=document.getElementsByTagName("script"),u=0;u<p.length;u++){var l=p[u];if(l.getAttribute("src")==n||l.getAttribute("data-webpack")==t+r){s=l;break}}s||(i=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",t+r),s.src=n),e[n]=[o];var d=(t,o)=>{s.onerror=s.onload=null,clearTimeout(h);var a=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),a&&a.forEach(e=>e(o)),t)return t(o)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),i&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{if("undefined"!=typeof document){var e={57:0};a.f.miniCss=(t,n)=>{e[t]?n.push(e[t]):0!==e[t]&&{352:1,472:1}[t]&&n.push(e[t]=(e=>new Promise((t,n)=>{var o=a.miniCssF(e),r=a.p+o;if(((e,t)=>{for(var n=document.getElementsByTagName("link"),o=0;o<n.length;o++){var a=(c=n[o]).getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(a===e||a===t))return c}var r=document.getElementsByTagName("style");for(o=0;o<r.length;o++){var c;if((a=(c=r[o]).getAttribute("data-href"))===e||a===t)return c}})(o,r))return t();((e,t,n,o,r)=>{var c=document.createElement("link");c.rel="stylesheet",c.type="text/css",a.nc&&(c.nonce=a.nc),c.onerror=c.onload=n=>{if(c.onerror=c.onload=null,"load"===n.type)o();else{var a=n&&n.type,s=n&&n.target&&n.target.href||t,i=new Error("Loading CSS chunk "+e+" failed.\n("+a+": "+s+")");i.name="ChunkLoadError",i.code="CSS_CHUNK_LOAD_FAILED",i.type=a,i.request=s,c.parentNode&&c.parentNode.removeChild(c),r(i)}},c.href=t,document.head.appendChild(c)})(e,r,0,t,n)}))(t).then(()=>{e[t]=0},n=>{throw delete e[t],n}))}}})(),(()=>{var e={57:0};a.f.j=(t,n)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise((n,a)=>o=e[t]=[n,a]);n.push(o[2]=r);var c=a.p+a.u(t),s=new Error;a.l(c,n=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),c=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+r+": "+c+")",s.name="ChunkLoadError",s.type=r,s.request=c,o[1](s)}},"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[c,s,i]=n,p=0;if(c.some(t=>0!==e[t])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);i&&i(a)}for(t&&t(n);p<c.length;p++)r=c[p],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=a(7723),c=a(6087);const s=window.wp.hooks;var i=a(5703);a(7162);const p=window.wp.compose;var u=a(790);const l=(0,p.createHigherOrderComponent)(e=>t=>(0,u.jsx)("div",{className:"sfw-admin-page",children:(0,u.jsx)(e,{...t})}),"withAdminPageShell");var d=a(6473);const h=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(207)]).then(a.bind(a,9484))),m=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(352)]).then(a.bind(a,8481))),f=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(472)]).then(a.bind(a,8052))),E=new Set,_=(0,i.getSetting)("admin")?.woocommerceTranslation||(0,r.__)("WooCommerce","snapchat-for-woocommerce"),C="woocommerce_admin_pages_list";let g=!1;const w=()=>{(0,s.addFilter)(C,"woocommerce/snapchat-for-woo/add-page-routes",e=>{const t=[["",_],["/marketing",(0,r.__)("Marketing","snapchat-for-woocommerce")],(0,r.__)("Snapchat for WooCommerce","snapchat-for-woocommerce")],n=[{breadcrumbs:[...t],container:h,path:"/snapchat/start",wpOpenMenu:"toplevel_page_woocommerce-marketing"},{breadcrumbs:[...t,(0,r.__)("Setup Snapchat","snapchat-for-woocommerce")],container:m,path:"/snapchat/setup"},{breadcrumbs:[...t,(0,r.__)("Settings","snapchat-for-woocommerce")],container:f,path:"/snapchat/settings",wpOpenMenu:"toplevel_page_woocommerce-marketing"}];return n.forEach(e=>{e.container=l(e.container);const t=e.path.substring(1).replace(/\//g,"_");E.add(t)}),g=!0,e.concat(n)})},S=()=>(0,s.hasAction)("hookAdded",`woocommerce/woocommerce/watch_${C}`);if((0,s.didFilter)(C)>0&&!S()&&!g){const e=Date.now(),t=setInterval(()=>{if(S())return clearInterval(t),void w();Date.now()-e>3e3&&clearInterval(t)},10)}else w();(0,s.addFilter)("woocommerce_tracks_client_event_properties","woocommerce/snapchat-for-woo/add-base-event-properties-to-page-view",(e,t)=>"wcadmin_page_view"===t&&E.has(e.path)?(0,d.qX)(e):e)})();
  • snapchat-for-woocommerce/tags/1.0.1/js/build/settings.js

    r3368691 r3408534  
    1 (globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[472],{4848:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-checkmark-circle",s,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658A9.98 9.98 0 0012 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10a9.94 9.94 0 00-.966-4.266L11 17.768z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}},6942:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function c(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return c.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)o.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},8052:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>D});var o=n(7723),c=n(6087),r=n(6476),a=n(14),s=n(8523),i=n(7892),l=n(6028),u=n(8242),d=n(9956),m=n(6427),f=n(9457),h=n(7792),p=n(7162);const _="all-accounts",w="snapchat-account";var g=n(790);const v={[_]:{title:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect all my accounts.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting any WordPress.com account and Snapchat account connected to this extension.","snapchat-for-woocommerce"),(0,o.__)("Lorem ipsum","snapchat-for-woocommerce"),(0,o.__)("Dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.","snapchat-for-woocommerce")]},[w]:{title:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect Snapchat Account","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect my Snapchat account.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting my Snapchat account from this WooCommerce extension.","snapchat-for-woocommerce"),(0,o.__)("Some configurations for Snapchat created through WooCommerce may be lost. This cannot be undone.","snapchat-for-woocommerce")]}};function x({disconnectTarget:e,onRequestClose:t,onDisconnected:n,disconnectAction:r}){const[a,s]=(0,c.useState)(!1),[l,u]=(0,c.useState)(!1),d=(0,p.j)(),{title:w,confirmButton:x,confirmation:y,contents:b}=v[e],j=()=>{l||t()};return(0,g.jsxs)(f.A,{className:"sfw-disconnect-accounts-modal",title:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(h.A,{size:20}),w]}),isDismissible:!l,buttons:[(0,g.jsx)(i.A,{isSecondary:!0,disabled:l,onClick:j,children:(0,o.__)("Never mind","snapchat-for-woocommerce")},"1"),(0,g.jsx)(i.A,{isPrimary:!0,isDestructive:!0,loading:l,disabled:!a,onClick:()=>{let o=e===_?d.disconnectAllAccounts:d.disconnectSnapchatAccount;r&&(o=r),u(!0),o().then(()=>{n(),t()}).catch(()=>{u(!1)})},eventName:"sfw_disconnect_snapchat_confirm_modal_button_click",children:x},"2")],onRequestClose:j,children:[b.map((e,t)=>(0,g.jsx)("p",{children:e},t)),(0,g.jsx)(m.CheckboxControl,{label:y,checked:a,disabled:l,onChange:s})]})}function y(e){return(0,g.jsx)(x,{...e})}var b=n(6473);function j(){const{hasFinishedResolution:e}=(0,s.A)(),[t,n]=(0,c.useState)(null);return(0,g.jsxs)(g.Fragment,{children:[t&&(0,g.jsx)(y,{onRequestClose:()=>n(null),onDisconnected:()=>{(0,b.Rv)("sfw_disconnected_accounts",{context:t}),window.location.reload()},disconnectTarget:t}),!e&&(0,g.jsx)(l.A,{}),e&&(0,g.jsx)(d.L4,{hideAccountSwitch:!0,children:(0,g.jsx)(u.A.Card.Footer,{children:(0,g.jsx)(i.A,{isDestructive:!0,isLink:!0,onClick:()=>n(w),eventName:"sfw_disconnect_snapchat_button_click",children:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce")})})})]})}var C=n(3905),S=n(2482),k=n(873);const{exportNonce:A}=C.nP;var P=n(5640);const{exportNonce:O}=C.nP,E=()=>{const{shouldTriggerExport:e,lastExportTimeStamp:t,exportFileUrl:n,hasFinishedResolution:r}=(0,k.A)(),[a,s]=(0,c.useState)("1"===C.nP.isExportInProgress),[l,u]=(0,c.useState)(C.nP.exportFileUrl||null),[d,f]=(0,c.useState)(C.nP.lastTimestamp||null),h=l&&d,{generateCsv:p}=((e,t)=>{const{createNotice:n}=(0,P.A)();return{generateCsv:(0,c.useCallback)(async()=>{try{const c=await window.jQuery.post(window.ajaxurl,{action:"snapchat_for_woocommerce_generate_feed",security:O});if(c.success)return void e();if(!c.success&&"snapchat_for_woocommerce_no_products_found"===c.data?.code)return void n("error",(0,o.__)("No products found. Please create products to generate the CSV.","snapchat-for-woocommerce"));n("error",(0,o.__)("An error occurred","snapchat-for-woocommerce")),t()}catch(e){n("error",(0,o.sprintf)(
     1(globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[472],{4848:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-checkmark-circle",s,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658A9.98 9.98 0 0012 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10a9.94 9.94 0 00-.966-4.266L11 17.768z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}},6942:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function c(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return c.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)o.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},8052:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>F});var o=n(7723),c=n(6087),r=n(6476),a=n(14),s=n(8523),i=n(7892),l=n(6028),u=n(8242),d=n(9956),m=n(6427),f=n(9457),h=n(7792),p=n(7162);const _="all-accounts",w="snapchat-account";var g=n(790);const v={[_]:{title:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect all my accounts.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting any WordPress.com account and Snapchat account connected to this extension.","snapchat-for-woocommerce"),(0,o.__)("Lorem ipsum","snapchat-for-woocommerce"),(0,o.__)("Dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.","snapchat-for-woocommerce")]},[w]:{title:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect Snapchat Account","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect my Snapchat account.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting my Snapchat account from this WooCommerce extension.","snapchat-for-woocommerce"),(0,o.__)("Some configurations for Snapchat created through WooCommerce may be lost. This cannot be undone.","snapchat-for-woocommerce")]}};function x({disconnectTarget:e,onRequestClose:t,onDisconnected:n,disconnectAction:r}){const[a,s]=(0,c.useState)(!1),[l,u]=(0,c.useState)(!1),d=(0,p.j)(),{title:w,confirmButton:x,confirmation:y,contents:b}=v[e],j=()=>{l||t()};return(0,g.jsxs)(f.A,{className:"sfw-disconnect-accounts-modal",title:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(h.A,{size:20}),w]}),isDismissible:!l,buttons:[(0,g.jsx)(i.A,{isSecondary:!0,disabled:l,onClick:j,children:(0,o.__)("Never mind","snapchat-for-woocommerce")},"1"),(0,g.jsx)(i.A,{isPrimary:!0,isDestructive:!0,loading:l,disabled:!a,onClick:()=>{let o=e===_?d.disconnectAllAccounts:d.disconnectSnapchatAccount;r&&(o=r),u(!0),o().then(()=>{n(),t()}).catch(()=>{u(!1)})},eventName:"sfw_disconnect_snapchat_confirm_modal_button_click",children:x},"2")],onRequestClose:j,children:[b.map((e,t)=>(0,g.jsx)("p",{children:e},t)),(0,g.jsx)(m.CheckboxControl,{label:y,checked:a,disabled:l,onChange:s})]})}function y(e){return(0,g.jsx)(x,{...e})}var b=n(6473);function j(){const{hasFinishedResolution:e}=(0,s.A)(),[t,n]=(0,c.useState)(null);return(0,g.jsxs)(g.Fragment,{children:[t&&(0,g.jsx)(y,{onRequestClose:()=>n(null),onDisconnected:()=>{(0,b.Rv)("sfw_disconnected_accounts",{context:t}),window.location.reload()},disconnectTarget:t}),!e&&(0,g.jsx)(l.A,{}),e&&(0,g.jsx)(d.L4,{hideAccountSwitch:!0,children:(0,g.jsx)(u.A.Card.Footer,{children:(0,g.jsx)(i.A,{isDestructive:!0,isLink:!0,onClick:()=>n(w),eventName:"sfw_disconnect_snapchat_button_click",children:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce")})})})]})}var C=n(3905),S=n(2482),k=n(873);const{exportNonce:A}=C.nP;var P=n(5640);const{exportNonce:O}=C.nP,E=()=>{const{shouldTriggerExport:e,lastExportTimeStamp:t,exportFileUrl:n,hasFinishedResolution:r}=(0,k.A)(),[a,s]=(0,c.useState)("1"===C.nP.isExportInProgress),[l,u]=(0,c.useState)(C.nP.exportFileUrl||null),[d,f]=(0,c.useState)(C.nP.lastTimestamp||null),h=l&&d,{generateCsv:p}=((e,t)=>{const{createNotice:n}=(0,P.A)();return{generateCsv:(0,c.useCallback)(async()=>{try{const c=await window.jQuery.post(window.ajaxurl,{action:"snapchat_for_woocommerce_generate_feed",security:O});if(c.success)return void e();if(!c.success&&"snapchat_for_woocommerce_no_products_found"===c.data?.code)return void n("error",(0,o.__)("No products found. Please create products to generate the CSV.","snapchat-for-woocommerce"));n("error",(0,o.__)("An error occurred","snapchat-for-woocommerce")),t()}catch(e){n("error",(0,o.sprintf)(
    22// translators: %s: The error message returned from the CSV generation process.
    33// translators: %s: The error message returned from the CSV generation process.
     
    55// translators: %s: The date and time when the product catalog was last exported.
    66// translators: %s: The date and time when the product catalog was last exported.
    7 (0,o.__)("Last exported on %s.","snapchat-for-woocommerce"),d):(0,o.__)("Your product catalog is not synced to Snapchat yet. Generate a CSV to manually upload.","snapchat-for-woocommerce"),indicator:h?(0,g.jsx)(m.Flex,{spacing:4,wrap:"wrap",children:(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_regenerate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Regenerate CSV","snapchat-for-woocommerce")})}):(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_generate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Generate CSV","snapchat-for-woocommerce")}),children:d&&!l&&(0,g.jsx)("div",{className:"sfw-product-catalog__help",children:(0,g.jsx)("p",{children:(0,o.__)('The CSV file may have been deleted and could not be found. Click "Generate CSV" to regenerate a new one.',"snapchat-for-woocommerce")})})})})},I=()=>{const{capiEnabled:e,collectPii:t,hasFinishedResolution:n}=(0,k.A)(),[r,a]=(0,c.useState)(!1),{createNotice:s}=(0,P.A)(),{updateSettings:i}=(0,p.j)(),u=(0,c.useCallback)(async()=>{const{settings:{capiEnabled:t}}=await i({capiEnabled:!e});(0,b.Sf)("sfw_conversion_tracking_toggle",{status:t?"on":"off"})},[i,e]),d=(0,c.useCallback)(async()=>{const{settings:{collectPii:e}}=await i({collectPii:!t});(0,b.Sf)("sfw_collect_pii_toggle",{status:e?"on":"off"})},[i,t]);return n?(0,g.jsx)(S.A,{className:"sfw-settings-track-conversions",title:(0,o.__)("Conversions API","snapchat-for-woocommerce"),description:(0,o.__)("Send server-side conversion events to improve attribution.","snapchat-for-woocommerce"),actions:(0,g.jsxs)("div",{className:"sfw-settings-track-conversions__actions",children:[(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Enable Conversions API tracking","snapchat-for-woocommerce"),checked:e,disabled:r,onChange:async()=>{try{a(!0),await u(),s("success",(0,o.__)("Conversions API Tracking status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}}})}),(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Collect Customer PII","snapchat-for-woocommerce"),checked:t,disabled:r,onChange:async()=>{try{a(!0),await d(),s("success",(0,o.__)("Collect PII status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}},help:(0,o.__)("Share additional customer data (PII) with both Pixel and Conversions API events to improve ads measurement.","snapchat-for-woocommerce")})})]})}):(0,g.jsx)(l.A,{})};var N=n(5659),T=n(3666);const D=()=>{(0,a.A)();const{isConnected:e,hasFinishedResolution:t}=(0,s.A)(),n="success"===(0,r.getQuery)()?.onboarding;return(0,c.useEffect)(()=>{!e&&t&&(0,r.getHistory)().replace((0,T.xP)())},[e,t]),(0,g.jsxs)("div",{className:"sfw-settings",children:[n&&(0,g.jsx)(N.A,{}),(0,g.jsx)(u.A,{title:(0,o.__)("Product Catalog","snapchat-for-woocommerce"),children:(0,g.jsx)(E,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Track Conversions","snapchat-for-woocommerce"),description:(0,o.__)("Manage how conversions are tracked on your site.","snapchat-for-woocommerce"),children:(0,g.jsx)(I,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Manage Snapchat Connection","snapchat-for-woocommerce"),description:(0,o.__)("See your currently connected account or disconnect.","snapchat-for-woocommerce"),children:(0,g.jsx)(j,{})})]})}},9031:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-notice-outline",s,!!function(e){return 0==e%18}(n)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}}}]);
     7(0,o.__)("Last exported on %s.","snapchat-for-woocommerce"),d):(0,o.__)("Your product catalog is not synced to Snapchat yet. Generate a CSV to manually upload.","snapchat-for-woocommerce"),indicator:h?(0,g.jsx)(m.Flex,{spacing:4,wrap:"wrap",children:(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_regenerate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Regenerate CSV","snapchat-for-woocommerce")})}):(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_generate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Generate CSV","snapchat-for-woocommerce")}),children:d&&!l&&(0,g.jsx)("div",{className:"sfw-product-catalog__help",children:(0,g.jsx)("p",{children:(0,o.__)('The CSV file may have been deleted and could not be found. Click "Generate CSV" to regenerate a new one.',"snapchat-for-woocommerce")})})})})},I=()=>{const{capiEnabled:e,collectPii:t,hasFinishedResolution:n}=(0,k.A)(),[r,a]=(0,c.useState)(!1),{createNotice:s}=(0,P.A)(),{updateSettings:i}=(0,p.j)(),u=(0,c.useCallback)(async()=>{const{settings:{capiEnabled:t}}=await i({capiEnabled:!e});(0,b.Sf)("sfw_conversion_tracking_toggle",{status:t?"on":"off"})},[i,e]),d=(0,c.useCallback)(async()=>{const{settings:{collectPii:e}}=await i({collectPii:!t});(0,b.Sf)("sfw_collect_pii_toggle",{status:e?"on":"off"})},[i,t]);return n?(0,g.jsx)(S.A,{className:"sfw-settings-track-conversions",title:(0,o.__)("Conversions API","snapchat-for-woocommerce"),description:(0,o.__)("Send server-side conversion events to improve attribution.","snapchat-for-woocommerce"),actions:(0,g.jsxs)("div",{className:"sfw-settings-track-conversions__actions",children:[(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Enable Conversions API tracking","snapchat-for-woocommerce"),checked:e,disabled:r,onChange:async()=>{try{a(!0),await u(),s("success",(0,o.__)("Conversions API Tracking status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}}})}),(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Collect Customer PII","snapchat-for-woocommerce"),checked:t,disabled:r,onChange:async()=>{try{a(!0),await d(),s("success",(0,o.__)("Collect PII status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}},help:(0,o.__)("Share additional customer data (PII) with both Pixel and Conversions API events to improve ads measurement.","snapchat-for-woocommerce")})})]})}):(0,g.jsx)(l.A,{})};var N=n(5659),T=n(3666),D=n(2465);const F=()=>{(0,a.A)();const{isConnected:e,hasFinishedResolution:t}=(0,s.A)(),n="success"===(0,r.getQuery)()?.onboarding;return(0,c.useEffect)(()=>{!e&&t&&(0,r.getHistory)().replace((0,T.xP)())},[e,t]),(0,g.jsxs)("div",{className:"sfw-settings",children:[n&&(0,g.jsx)(N.A,{}),C.nP.isLegacyPluginActive&&(0,g.jsx)(u.A,{children:(0,g.jsx)(D.A,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Product Catalog","snapchat-for-woocommerce"),children:(0,g.jsx)(E,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Track Conversions","snapchat-for-woocommerce"),description:(0,o.__)("Manage how conversions are tracked on your site.","snapchat-for-woocommerce"),children:(0,g.jsx)(I,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Manage Snapchat Connection","snapchat-for-woocommerce"),description:(0,o.__)("See your currently connected account or disconnect.","snapchat-for-woocommerce"),children:(0,g.jsx)(j,{})})]})}},9031:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-notice-outline",s,!!function(e){return 0==e%18}(n)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}}}]);
  • snapchat-for-woocommerce/tags/1.0.1/js/src/components/section/index.js

    r3368691 r3408534  
    4343    return (
    4444        <section className={ sectionClassName }>
    45             <header className="sfw-section__header">
    46                 { topContent && <p>{ topContent }</p> }
    47                 { title && <h1>{ title }</h1> }
    48                 { description }
    49             </header>
     45            { ( topContent || title || description ) && (
     46                <header className="sfw-section__header">
     47                    { topContent && <p>{ topContent }</p> }
     48                    { title && <h1>{ title }</h1> }
     49                    { description }
     50                </header>
     51            ) }
    5052            <Flex
    5153                className="sfw-section__body"
  • snapchat-for-woocommerce/tags/1.0.1/js/src/pages/settings/index.js

    r3368691 r3408534  
    1717import OnboardingSuccessModal from '~/components/onboarding-success-modal';
    1818import { getOnboardingUrl } from '~/utils/urls';
     19import LegacyPluginActiveNotice from '~/components/legacy-plugin-active-notice';
     20import { sfwData } from '~/constants';
    1921import './index.scss';
    2022
     
    3739        <div className="sfw-settings">
    3840            { isOnboardingSuccessModalOpen && <OnboardingSuccessModal /> }
     41
     42            { sfwData.isLegacyPluginActive && (
     43                <Section>
     44                    <LegacyPluginActiveNotice />
     45                </Section>
     46            ) }
    3947
    4048            <Section
  • snapchat-for-woocommerce/tags/1.0.1/package-lock.json

    r3368691 r3408534  
    4949                "stylelint-config-standard-scss": "^15.0.1",
    5050                "typescript": "^5.5.4",
    51                 "woocommerce-grow-jsdoc": "https://gitpkg.now.sh/woocommerce/grow/packages/js/jsdoc?eabdb5c3e6f089499a9bc62ec2e5e2251d7b23ca"
     51                "woocommerce-grow-jsdoc": "git+https://github.com/woocommerce/grow#jsdoc-v1"
    5252            },
    5353            "engines": {
     
    3374133741        },
    3374233742        "node_modules/woocommerce-grow-jsdoc": {
    33743             "version": "0.0.2",
    33744             "resolved": "https://gitpkg.now.sh/woocommerce/grow/packages/js/jsdoc?eabdb5c3e6f089499a9bc62ec2e5e2251d7b23ca",
    33745             "integrity": "sha512-r8yvGjSD7DSEfg6OsuEFnjIcsR8kZ8NRWclNAbTssgnSoZzwRU0hzGnGTHHa3wfrK5M8KjPtZvmZfofQbCQPqw==",
     33743            "version": "1.0.0",
     33744            "resolved": "git+ssh://[email protected]/woocommerce/grow.git#d1822ab1ad130d28d096845798200782e3a8f59d",
    3374633745            "dev": true,
    3374733746            "license": "GPL-3.0-or-later",
     
    3375233751                "jsdoc-plugin-typescript": "^2.2.1",
    3375333752                "shelljs": "^0.8.5",
    33754                 "woocommerce-grow-tracking-jsdoc": "https://gitpkg.now.sh/woocommerce/grow/packages/js/tracking-jsdoc?a22d3df5e1b121ab186c57fa4fb9bbc989c86fba"
     33753                "woocommerce-grow-tracking-jsdoc": "git+https://github.com/woocommerce/grow#tracking-jsdoc-v1"
    3375533754            },
    3375633755            "bin": {
    3375733756                "woocommerce-grow-jsdoc": "bin/jsdoc.mjs"
     33757            },
     33758            "engines": {
     33759                "node": ">=16"
    3375833760            }
    3375933761        },
    3376033762        "node_modules/woocommerce-grow-tracking-jsdoc": {
    33761             "version": "0.0.2",
    33762             "resolved": "https://gitpkg.now.sh/woocommerce/grow/packages/js/tracking-jsdoc?a22d3df5e1b121ab186c57fa4fb9bbc989c86fba",
    33763             "integrity": "sha512-RMZecq3RbgutjnmAbrO0dLBQ/MX3i/kQXyHGeYITocOIDZIabUX6mvEEK2uHu2frtvAVn154u3upEMk7X8JZnw==",
     33763            "version": "1.0.0",
     33764            "resolved": "git+ssh://[email protected]/woocommerce/grow.git#ac115c64c5427ae6b2a9d9ccd0498e82a1864a8e",
    3376433765            "dev": true,
    3376533766            "license": "GPL-3.0-or-later",
     33767            "engines": {
     33768                "node": ">=16"
     33769            },
    3376633770            "peerDependencies": {
    3376733771                "jsdoc": "^4.0.2"
  • snapchat-for-woocommerce/tags/1.0.1/package.json

    r3368691 r3408534  
    5757        "stylelint-config-standard-scss": "^15.0.1",
    5858        "typescript": "^5.5.4",
    59         "woocommerce-grow-jsdoc": "https://gitpkg.now.sh/woocommerce/grow/packages/js/jsdoc?eabdb5c3e6f089499a9bc62ec2e5e2251d7b23ca"
     59        "woocommerce-grow-jsdoc": "git+https://github.com/woocommerce/grow#jsdoc-v1"
    6060    },
    6161    "overrides": {
  • snapchat-for-woocommerce/tags/1.0.1/readme.txt

    r3368695 r3408534  
    22Contributors: automattic, woocommerce
    33Tags: woocommerce, snapchat, product feed, ads
    4 Tested up to: 6.8
    5 Stable tag: 1.0.0
     4Tested up to: 6.9
     5Stable tag: 1.0.1
    66License: GPLv3
    77License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • snapchat-for-woocommerce/tags/1.0.1/snapchat-for-woocommerce.php

    r3368691 r3408534  
    33 * Plugin Name: Snapchat for WooCommerce
    44 * Description: Seamlessly integrates your WooCommerce store with Snapchat's powerful advertising platform, enabling you to reach millions of potential customers through engaging visual ads.
    5  * Version: 1.0.0
     5 * Version: 1.0.1
    66 * Author: WooCommerce
    77 * Author URI: https://woocommerce.com/
     
    1010 * Requires Plugins: woocommerce
    1111 * Requires PHP: 7.4
     12 * PHP tested up to: 8.4
    1213 * Requires at least: 6.7
    13  * WC requires at least: 10.0
    14  * WC tested up to: 10.2
     14 * Tested up to: 6.9
     15 * WC requires at least: 10.1
     16 * WC tested up to: 10.3
    1517 *
    1618 * License: GNU General Public License v3.0
     
    2830
    2931if ( ! defined( 'SNAPCHAT_FOR_WOOCOMMERCE_VERSION' ) ) {
    30     define( 'SNAPCHAT_FOR_WOOCOMMERCE_VERSION', '1.0.0' );
     32    define( 'SNAPCHAT_FOR_WOOCOMMERCE_VERSION', '1.0.1' );
    3133}
    3234
  • snapchat-for-woocommerce/tags/1.0.1/vendor/autoload.php

    r3368691 r3408534  
    1515        }
    1616    }
    17     throw new RuntimeException($err);
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
    1821}
    1922
  • snapchat-for-woocommerce/tags/1.0.1/vendor/composer/InstalledVersions.php

    r3368691 r3408534  
    2727class InstalledVersions
    2828{
    29     /**
    30      * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
    31      * @internal
    32      */
    33     private static $selfDir = null;
    34 
    3529    /**
    3630     * @var mixed[]|null
     
    330324
    331325    /**
    332      * @return string
    333      */
    334     private static function getSelfDir()
    335     {
    336         if (self::$selfDir === null) {
    337             self::$selfDir = strtr(__DIR__, '\\', '/');
    338         }
    339 
    340         return self::$selfDir;
    341     }
    342 
    343     /**
    344326     * @return array[]
    345327     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     
    355337
    356338        if (self::$canGetVendors) {
    357             $selfDir = self::getSelfDir();
     339            $selfDir = strtr(__DIR__, '\\', '/');
    358340            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    359341                $vendorDir = strtr($vendorDir, '\\', '/');
  • snapchat-for-woocommerce/tags/1.0.1/vendor/composer/installed.php

    r3368691 r3408534  
    44        'pretty_version' => 'dev-trunk',
    55        'version' => 'dev-trunk',
    6         'reference' => '8c3fe001e8cc2b8c6331b6f52be630213f5f80c0',
     6        'reference' => 'd72595c4aa920d0a593bb5586ef5896fc1f5b3f6',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    2323            'pretty_version' => 'dev-trunk',
    2424            'version' => 'dev-trunk',
    25             'reference' => '8c3fe001e8cc2b8c6331b6f52be630213f5f80c0',
     25            'reference' => 'd72595c4aa920d0a593bb5586ef5896fc1f5b3f6',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../../',
  • snapchat-for-woocommerce/trunk/changelog.txt

    r3368691 r3408534  
    11***Snapchat for WooCommerce Changelog ***
     2
     32025-12-02 - version 1.0.1
     4* Add - Display an admin notice prompting users to uninstall the legacy Snapchat Pixel plugin if it is installed and active.
     5* Fix - Improve tracking by deduplicating events sent from Pixel and Conversion API.   
     6* Tweak - WooCommerce 10.3 compatibility.
     7* Tweak - WordPress 6.9 compatibility.
    28
    392025-09-26 - version 1.0.0
  • snapchat-for-woocommerce/trunk/includes/Admin/Assets.php

    r3368691 r3408534  
    7575            'AdminData',
    7676            array(
    77                 'setupComplete'      => boolval( Options::get( OptionDefaults::ONBOARDING_STATUS ) === 'connected' ),
    78                 'status'             => Options::get( OptionDefaults::ONBOARDING_STATUS ),
    79                 'step'               => Options::get( OptionDefaults::ONBOARDING_STEP ),
    80                 'exportNonce'        => wp_create_nonce( 'export-nonce' ),
    81                 'isExportInProgress' => ServiceContainer::get( ServiceKey::PRODUCT_EXPORT_SERVICE )->job->is_job_in_progress( ProductExportService::ACTION_HOOK ),
    82                 'exportFileUrl'      => file_exists( $csv_path ) ? Options::get( OptionDefaults::EXPORT_FILE_URL ) : '',
    83                 'lastTimestamp'      => Helper::get_formatted_timestamp( Options::get( OptionDefaults::LAST_EXPORT_TIMESTAMP ) ),
    84                 'slug'               => 'snapwoo',
    85                 'pluginVersion'      => SNAPCHAT_FOR_WOOCOMMERCE_VERSION,
    86                 'adAccountId'        => Options::get( OptionDefaults::AD_ACCOUNT_ID ),
     77                'setupComplete'        => boolval( Options::get( OptionDefaults::ONBOARDING_STATUS ) === 'connected' ),
     78                'status'               => Options::get( OptionDefaults::ONBOARDING_STATUS ),
     79                'step'                 => Options::get( OptionDefaults::ONBOARDING_STEP ),
     80                'exportNonce'          => wp_create_nonce( 'export-nonce' ),
     81                'isExportInProgress'   => ServiceContainer::get( ServiceKey::PRODUCT_EXPORT_SERVICE )->job->is_job_in_progress( ProductExportService::ACTION_HOOK ),
     82                'exportFileUrl'        => file_exists( $csv_path ) ? Options::get( OptionDefaults::EXPORT_FILE_URL ) : '',
     83                'lastTimestamp'        => Helper::get_formatted_timestamp( Options::get( OptionDefaults::LAST_EXPORT_TIMESTAMP ) ),
     84                'slug'                 => 'snapwoo',
     85                'pluginVersion'        => SNAPCHAT_FOR_WOOCOMMERCE_VERSION,
     86                'adAccountId'          => Options::get( OptionDefaults::AD_ACCOUNT_ID ),
     87                'isLegacyPluginActive' => Helper::is_legacy_snapchat_plugin_active(),
    8788            )
    8889        );
  • snapchat-for-woocommerce/trunk/includes/ServiceContainer.php

    r3368691 r3408534  
    122122                    new Admin\Onboarding(),
    123123                    new ProductMeta\ProductMetaFields(),
     124                    new Admin\Notices(),
    124125                );
    125126
  • snapchat-for-woocommerce/trunk/includes/Tracking/ConversionEvent/PurchaseEvent.php

    r3368691 r3408534  
    9797            'event_name'       => self::ID,
    9898            'event_source_url' => $this->order->get_checkout_order_received_url(),
    99             'event_id'         => EventIdRegistry::get_purchase_id( $this->order->get_id() ),
     99            'event_id'         => EventIdRegistry::get_purchase_id(),
    100100            'user_data'        => array(),
    101101            'custom_data'      => array(
  • snapchat-for-woocommerce/trunk/includes/Tracking/EventIdRegistry.php

    r3368691 r3408534  
    2323
    2424    /**
    25      * Returns a order key for the given purchase.
    26      *
    27      * Uses the WooCommerce order ID as the key.
     25     * Returns a unique event ID for the purchase event.
    2826     *
    2927     * @since 0.1.0
    3028     *
    31      * @param int $order_id The Order ID.
    32      *
    33      * @return string Order key.
     29     * @return string Unique event ID.
    3430     */
    35     public static function get_purchase_id( $order_id ): string {
    36         $order = wc_get_order( $order_id );
    37         return $order instanceof \WC_Order ? (string) $order->get_order_key() : '';
     31    public static function get_purchase_id(): string {
     32        static $purchase_event_id = null;
     33        if ( null === $purchase_event_id ) {
     34            $purchase_event_id = wp_generate_uuid4();
     35        }
     36        return $purchase_event_id;
    3837    }
    3938}
  • snapchat-for-woocommerce/trunk/includes/Tracking/RemotePixelTracker.php

    r3368691 r3408534  
    217217        $order->save_meta_data();
    218218
    219         $order_key       = $order->get_order_key();
    220219        $total           = $order->get_total();
    221220        $currency        = $order->get_currency();
     
    244243        }
    245244
    246         $payload = array(
    247             'price'          => $total,
    248             'currency'       => $currency,
    249             'event_id'       => $order_key,
    250             'transaction_id' => $order_key,
    251             'item_ids'       => $item_ids,
    252             'item_category'  => implode( ', ', array_unique( $item_categories ) ),
    253             'number_items'   => $number_items,
    254             'integration'    => 'woocommerce-v1',
    255             'ip_address'     => UserIdentifier::add_ip_address(),
     245        $event_id = EventIdRegistry::get_purchase_id();
     246        $payload  = array(
     247            'price'           => $total,
     248            'currency'        => $currency,
     249            'event_id'        => $event_id,
     250            'client_dedup_id' => $event_id,
     251            'transaction_id'  => $order_id,
     252            'item_ids'        => $item_ids,
     253            'item_category'   => implode( ', ', array_unique( $item_categories ) ),
     254            'number_items'    => $number_items,
     255            'integration'     => 'woocommerce-v1',
     256            'ip_address'      => UserIdentifier::add_ip_address(),
    256257        );
    257258
  • snapchat-for-woocommerce/trunk/includes/Utils/Helper.php

    r3368691 r3408534  
    214214        return $data;
    215215    }
     216
     217    /**
     218     * Checks if the legacy Snapchat plugin is active.
     219     *
     220     * @return bool True if the legacy Snapchat plugin is active, false otherwise.
     221     */
     222    public static function is_legacy_snapchat_plugin_active() {
     223        return is_plugin_active( 'snap-pixel-for-woocommerce/snapchat-pixel-for-woocommerce.php' ) || class_exists( 'snap_pixel' );
     224    }
    216225}
  • snapchat-for-woocommerce/trunk/js/build/commons.js

    r3368691 r3408534  
    1 "use strict";(globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[223],{14:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={match:{url:"/snapchat/start"},wpOpenMenu:"toplevel_page_woocommerce-marketing"};function a(){return(0,c.useEffect)(()=>{window.wpNavMenuClassChange(n,n.match.url)})}},873:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getSettings",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui),t=s[a]();return{capiEnabled:t.capiEnabled,collectPii:t.collectPii,shouldTriggerExport:t.triggerExport,lastExportTimeStamp:t.lastExportTimeStamp,exportFileUrl:t.exportFileUrl,hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},1968:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(5703);const n=()=>(0,c.getSetting)("adminUrl")},2224:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8468),n=t(6087);const a=e=>{const s=(0,n.useRef)(e);return(0,c.isEqual)(s.current,e)||(s.current=e),s.current}},2482:(e,s,t)=>{t.d(s,{x:()=>p,A:()=>_});var c=t(7723),n=t(6942),a=t.n(n),o=t(8242),r=t(8771);const i=t.p+"images/js/src/images/logo/snapchat.svg",l=t.p+"images/js/src/images/logo/wp.svg";var d=t(790);const p={EMPTY:"empty",WPCOM:"wpcom",SNAPCHAT:"snapchat"},u=(0,d.jsx)("img",{src:i,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),h=(0,d.jsx)("img",{src:l,alt:(0,c.__)("WordPress.com Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),m={[p.EMPTY]:{},[p.WPCOM]:{icon:h,title:"WordPress.com"},[p.SNAPCHAT]:{icon:u,title:(0,c.__)("Snapchat","snapchat-for-woocommerce")}},f={center:!1,top:"sfw-account-card__styled--align-top"},w={...f,toDetail:"sfw-account-card__indicator--align-to-detail"};function _({className:e,disabled:s=!1,appearance:t=p.EMPTY,icon:c=m[t].icon,title:n=m[t].title,description:i=m[t].description,helper:l,alignIcon:u="center",indicator:h,alignIndicator:_="center",detail:x,expandedDetail:g=!1,actions:j,children:v,...A}){const N=a()("sfw-account-card",!!s&&"sfw-account-card--is-disabled",!!g&&"sfw-account-card--is-expanded-detail",e),b=a()("sfw-account-card__icon",f[u]),y=a()("sfw-account-card__indicator",w[_]);return(0,d.jsxs)(o.A.Card,{className:N,...A,children:[(0,d.jsx)(o.A.Card.Body,{children:(0,d.jsxs)("div",{className:"sfw-account-card__body-layout",children:[c&&(0,d.jsx)("div",{className:b,children:c}),(0,d.jsxs)("div",{className:"sfw-account-card__subject",children:[n&&(0,d.jsx)(r.A.Title,{className:"sfw-account-card__title",children:n}),i&&(0,d.jsx)("div",{className:"sfw-account-card__description",children:i}),l&&(0,d.jsx)("div",{className:"sfw-account-card__helper",children:l})]}),x&&(0,d.jsx)("div",{className:"sfw-account-card__detail",children:x}),h&&(0,d.jsx)("div",{className:y,children:h}),j&&(0,d.jsx)("div",{className:"sfw-account-card__actions",children:j})]})}),v]})}},3164:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",title:t,description:n}=e;return(0,c.jsxs)("header",{className:`sfw-step-content-header ${s}`,children:[(0,c.jsx)("h1",{children:t}),(0,c.jsx)("div",{className:"sfw-step-content-header__description",children:n})]})}},3666:(e,s,t)=>{t.d(s,{FN:()=>a,xP:()=>n});var c=t(6476);const n=()=>(0,c.getNewPath)(null,"/snapchat/setup",null),a=()=>(0,c.getNewPath)(null,"/snapchat/settings",null)},3704:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",...t}=e;return(0,c.jsx)("div",{className:`sfw-step-content-actions ${s}`,...t})}},3741:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(7723),a=t(790);const o=()=>(0,a.jsx)("div",{className:"sfw-app-spinner",role:"status","aria-label":(0,n.__)("Loading…","snapchat-for-woocommerce"),children:(0,a.jsx)(c.Spinner,{})})},4566:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6942),n=t.n(c),a=t(7723),o=t(6427),r=t(4848),i=t(790);const l=e=>{const{className:s}=e;return(0,i.jsxs)(o.Flex,{className:n()("sfw-connected-icon-label",s),align:"center",gap:1,children:[(0,i.jsx)(o.FlexItem,{children:(0,i.jsx)(r.A,{})}),(0,i.jsx)(o.FlexItem,{children:(0,a.__)("Connected","snapchat-for-woocommerce")})]})}},4790:(e,s,t)=>{t.d(s,{Ay:()=>w});var c=t(7723);function n(e){return"yes"!==e.active?"":"yes"===e.owner?e.email:(0,c.__)("Successfully connected through Jetpack","snapchat-for-woocommerce")}var a=t(2482),o=t(4566),r=t(790);const i=({jetpack:e})=>(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:n(e),indicator:(0,r.jsx)(o.A,{})});var l=t(3832),d=t(3905),p=t(6520),u=t(7892),h=t(5640),m=t(6599);const f=()=>{const{createNotice:e}=(0,h.A)(),s=d.nP?.setupComplete?"reconnect":"setup-snapchat",t={next_page_name:s},n=(0,l.addQueryArgs)(`${p.RV}/jetpack/connect`,t),[o,{loading:i,data:f}]=(0,m.A)({path:n});return(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:(0,c.__)("Required to connect with Snapchat","snapchat-for-woocommerce"),indicator:(0,r.jsx)(u.A,{isSecondary:!0,loading:i||f,eventName:"sfw_wordpress_account_connect_button_click",eventProps:{context:s},onClick:async()=>{try{const e=await o();window.location.href=e.url}catch(s){e("error",(0,c.__)("Unable to connect your WordPress.com account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,c.__)("Connect","snapchat-for-woocommerce")})})},w=({jetpack:e})=>"yes"===e.active?(0,r.jsx)(i,{jetpack:e}):(0,r.jsx)(f,{})},5640:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(7143);const n=()=>(0,c.useDispatch)("core/notices")},5659:(e,s,t)=>{t.d(s,{A:()=>u});var c=t(7723),n=t(6427),a=t(6476),o=t(7892),r=t(9457);const i=t.p+"images/js/src/images/logo/woocommerce.svg",l=t.p+"images/js/src/images/logo/snapchat-wide.svg";var d=t(3666),p=t(790);const u=()=>{const e=()=>{(0,a.getHistory)().replace((0,d.FN)())};return(0,p.jsxs)(r.A,{className:"sfw-onboarding-success-modal",onRequestClose:e,buttons:[(0,p.jsx)(o.A,{variant:"secondary",onClick:e,children:(0,c.__)("Close","snapchat-for-woocommerce")},"close")],children:[(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__logos",children:(0,p.jsxs)(n.Flex,{gap:6,align:"center",justify:"center",children:[(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:i,alt:(0,c.__)("WooCommerce Logo","snapchat-for-woocommerce"),width:"187.5"})}),(0,p.jsx)(n.FlexItem,{className:"sfw-onboarding-success-modal__logo-separator-line"}),(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:l,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"123"})})]})}),(0,p.jsxs)("div",{className:"sfw-onboarding-success-modal__content",children:[(0,p.jsx)("h2",{className:"sfw-onboarding-success-modal__title",children:(0,c.__)("You’ve successfully set up Snapchat for WooCommerce! 🎉","snapchat-for-woocommerce")}),(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__description",children:(0,c.__)("Your store is now connected to Snapchat. You can start running ads, track performance, and reach Snapchat users with your WooCommerce products.","snapchat-for-woocommerce")})]})]})}},6028:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(3741),n=t(8242),a=t(790);const o=()=>(0,a.jsx)(n.A.Card,{children:(0,a.jsx)(n.A.Card.Body,{children:(0,a.jsx)(c.A,{})})})},6474:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={"full-page":["woocommerce-admin-full-screen","is-wp-toolbar-disabled","sfw-full-page"],"full-content":["sfw-full-content"]};function a(e){(0,c.useEffect)(()=>{if(!n.hasOwnProperty(e))return;const s=document.body.classList,t=n[e].filter(e=>!s.contains(e));return s.add(...t),()=>{s.remove(...t)}},[e])}},6599:(e,s,t)=>{t.d(s,{A:()=>m});var c=t(6087),n=t(1455),a=t.n(n),o=t(2224);const r="START",i="FINISH",l="ERROR",d="RESET",p={loading:!1,error:void 0,data:void 0,response:void 0,options:void 0},u=(e,s)=>{switch(s.type){case r:return{...e,loading:!0,options:s.options};case i:return{...e,loading:!1,data:s.data,response:s.response,options:s.options};case l:return{...e,loading:!1,error:s.error,response:s.response,options:s.options};case d:return s.state}},h=e=>{const{parse:s=!0}=e;return s},m=(e,s=p)=>{const t=(0,o.A)(e),n={...p,...s},[m,f]=(0,c.useReducer)(u,n);return[(0,c.useCallback)(async e=>{const s={...t,...e};f({type:r,options:s});try{const e=await a()({...s,parse:!1}),t=e.clone(),c=t.json&&await t.json();return f({type:i,data:c,response:e,options:s}),h(s)?c:e}catch(e){if("fetch_error"===e.code)throw f({type:l,error:e,response:void 0,options:s}),e;const t=e;let c;try{const e=t.clone();c=e.json?await e.json():new Error("No content body in fetch response.")}catch(e){c=new Error("Error parsing response.")}throw f({type:l,error:c,response:t,options:s}),h(s)?c:t}},[t]),{...m,reset:e=>{f({type:d,state:{...n,...e}})}}]}},7401:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getJetpackAccount",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui);return{jetpack:s[a](),hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},7539:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(8687),a=t(790);const o=({title:e,backHref:s,helpButton:t,onBackButtonClick:o})=>(0,a.jsxs)("div",{className:"sfw-stepper-top-bar",children:[(0,a.jsx)(c.Link,{className:"components-button sfw-stepper-top-bar__back-button",href:s,type:"wc-admin",onClick:o,children:(0,a.jsx)(n.A,{})}),(0,a.jsx)("span",{className:"sfw-stepper-top-bar__title",children:e}),t]})},7792:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(9031),n=t(790);const a=({size:e=18})=>(0,n.jsx)(c.A,{className:"sfw-warning-icon",size:e})},7892:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6427),n=t(8846),a=t(6942),o=t.n(a),r=t(6473),i=t(790);const l=e=>{const{className:s,disabled:t,loading:a,eventName:l,eventProps:d,text:p,onClick:u=()=>{},...h}=e,m=t||a,f=["sfw-app-button",s];let w;return a&&(w=(0,i.jsx)(n.Spinner,{})),p&&(w=(0,i.jsxs)(i.Fragment,{children:[a&&(0,i.jsx)(n.Spinner,{}),p]}),h.icon&&f.push("sfw-app-button--icon-with-text"),"right"===h.iconPosition&&f.push("sfw-app-button--icon-position-right")),(0,i.jsx)(c.Button,{className:o()(...f),disabled:m,"aria-disabled":m,text:w,onClick:(...e)=>{l&&(0,r.Sf)(l,d),u(...e)},...h})}},7952:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6087),a=t(6520),o=t(7162),r=t(2224);const i=()=>((e,...s)=>{const{invalidateResolution:t}=(0,o.j)(),i=(0,r.A)(s),l=(0,n.useCallback)(()=>{t(e,i)},[t,e,i]);return(0,c.useSelect)(s=>{const{isResolving:t,hasFinishedResolution:c}=s(a.Ui),n=s(a.Ui)[e](...i);return{isResolving:t(e,i),hasFinishedResolution:c(e,i),data:n,invalidateResolution:l}},[l,e,i])})("getSetup")},8242:(e,s,t)=>{t.d(s,{A:()=>d});var c=t(6942),n=t.n(c),a=t(6427),o=t(790);var r=t(8771);const i=({size:e="",...s})=>(0,o.jsx)(a.Card,{...s,size:e});i.Body=e=>{const{className:s,...t}=e;return(0,o.jsx)(a.CardBody,{className:n()("sfw-section-card-body",s),...t})},i.Footer=e=>{const{children:s,...t}=e;return(0,o.jsx)(a.CardFooter,{className:"sfw-section-card-footer",...t,children:s})},i.Title=e=>{const{className:s,...t}=e;return(0,o.jsx)(r.A.Title,{className:n()("sfw-section-card-title",s),...t})};const l=({className:e,title:s,description:t,topContent:c,children:r,disabled:i,disabledLeft:l,verticalGap:d=6})=>{const p=n()("sfw-section",!!i&&"sfw-section--is-disabled",!!l&&"sfw-section--is-disabled-left",e);return(0,o.jsxs)("section",{className:p,children:[(0,o.jsxs)("header",{className:"sfw-section__header",children:[c&&(0,o.jsx)("p",{children:c}),s&&(0,o.jsx)("h1",{children:s}),t]}),(0,o.jsx)(a.Flex,{className:"sfw-section__body",direction:"column",gap:d,children:r})]})};l.Card=i;const d=l},8523:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6520),a=t(3905),o=t(7952);const r="getSnapchatAccount",i=()=>{const{data:e}=(0,o.A)(),s=e?.status===a.Dh.CONNECTED;return(0,c.useSelect)(e=>{const t=e(n.Ui),c=t[r]();return{status:c?.status,isConnected:c?.status===a.C5.CONNECTED&&s,hasFinishedResolution:t.hasFinishedResolution(r,[])}},[s])}},8771:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(6942),n=t.n(c),a=t(790);const o=e=>{const{className:s="",...t}=e;return(0,a.jsx)("div",{className:`sfw-subsection ${s}`,...t})};o.Title=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-title",s),...t})},o.Subtitle=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-subtitle",s),...t})},o.Body=e=>{const{children:s}=e;return(0,a.jsx)("div",{className:"sfw-subsection-body",children:s})},o.HelperText=e=>{const{className:s,children:t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-helper-text",s),children:t})};const r=o},9180:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(7723),n=t(4236),a=t(7892),o=t(790);const r=({eventContext:e})=>(0,o.jsxs)(a.A,{className:"sfw-help-icon-button",href:"https://woocommerce.com/document/snapchat-for-woocommerce/",target:"_blank",eventName:"sfw_help_click",eventProps:{context:e},children:[(0,o.jsx)(n.A,{}),(0,c.__)("Help","snapchat-for-woocommerce")]})},9370:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",children:t,...n}=e;return(0,c.jsx)("div",{className:`sfw-step-content ${s}`,...n,children:(0,c.jsx)("div",{className:"sfw-step-content__container",children:t})})}},9457:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(6427),n=t(6942),a=t.n(n),o=t(790);const r={auto:!1,visible:"swf-app-modal__styled--overflow-visible"},i=({className:e,overflow:s="auto",buttons:t=[],children:n,...i})=>{const l=a()("sfw-admin-page","sfw-app-modal",r[s],e);return(0,o.jsxs)(c.Modal,{className:l,...i,children:[n,t.length>=1&&(0,o.jsx)("div",{className:"sfw-app-modal__footer",children:t})]})}},9826:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8242),n=t(790);const a=({children:e})=>(0,n.jsx)(c.A,{className:"sfw-step-content-footer",verticalGap:10,children:e})},9956:(e,s,t)=>{t.d(s,{L4:()=>j,Ay:()=>y});var c=t(6476),n=t(8523),a=t(7723),o=t(7143),r=t(6087),i=t(7162),l=t(6520);const d="getSnapchatAccountDetails";var p=t(790);const u=()=>{const{org_name:e,ad_acc_id:s,ad_acc_name:t,pixel_id:c}=(()=>{const e=(0,i.j)(),s=(0,r.useCallback)(()=>{e.invalidateResolution(d,[])},[e]);return(0,o.useSelect)(e=>{const t=e(l.Ui);return{...t[d](),refetchSnapchatAccountDetails:s,hasFinishedResolution:t.hasFinishedResolution(d,[])}},[s])})();return(0,p.jsxs)("div",{className:"sfw-snapchat-account-details",children:[e&&(0,p.jsxs)("p",{children:[(0,a.__)("Organization:","snapchat-for-woocommerce")," ",e]}),s&&t&&(0,p.jsxs)("p",{children:[(0,a.__)("Ads Account:","snapchat-for-woocommerce")," ",t," (",s,")"]}),c&&(0,p.jsxs)("p",{children:[(0,a.__)("Pixel ID:","snapchat-for-woocommerce")," ",c]})]})};var h=t(7892),m=t(3832),f=t(6599),w=t(5640);const _=({text:e=(0,a.__)("Or, connect to a different Snapchat account","snapchat-for-woocommerce"),...s})=>{const[t,{loading:c}]=(()=>{const{createNotice:e,removeNotice:s}=(0,w.A)(),{disconnectSnapchatAccount:t}=(0,i.j)(),[c,n]=(0,r.useState)(!1),[o,{loading:d,data:p}]=function(e){const s=(0,r.useMemo)(()=>{const s={next_page_name:e};return{path:(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,s)}},[e]);return(0,f.A)(s)}("setup-snapchat");return[async()=>{const{notice:c}=await e("info",(0,a.__)("Connecting to a different Snapchat account, please wait…","snapchat-for-woocommerce"));n(!0);try{await t();const{url:e}=await o();e&&(window.location.href=e)}catch(t){s(c.id),e("error",(0,a.__)("Unable to connect to a different Snapchat account. Please try again later.","snapchat-for-woocommerce"))}finally{n(!1)}},{loading:c||d||p}]})();return(0,p.jsx)(h.A,{isLink:!0,disabled:c,text:e,eventName:"sfw_snapchat_account_connect_different_account_button_click",onClick:t,...s})};var x=t(2482),g=t(4566);const j=({hideAccountSwitch:e=!1,children:s})=>(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,description:(0,p.jsx)(u,{}),indicator:(0,p.jsx)(g.A,{}),actions:e?null:(0,p.jsx)(_,{isTertiary:!0}),children:s});var v=t(3905),A=t(3666);const N=(e,s)=>{const{createNotice:t}=(0,w.A)(),{fetchSnapchatAccount:n,fetchSetup:a}=(0,i.j)(),[o,d]=(0,r.useState)(!1),[p]=(0,f.A)({path:`${l.RV}/snapchat/config`,method:"POST",data:{id:e,products_token:s}});return{upsertSnapchatConfig:(0,r.useCallback)(async()=>{if(!e||!s)return!1;d(!0);try{await p({parse:!1})}catch(e){t("error",e.message)}await n(),await a(),(0,c.getHistory)().replace((0,A.xP)()),d(!1)},[t,p,n,a,e,s]),loading:o}},b=({disabled:e,configId:s,productsToken:t})=>{const{createNotice:c}=(0,w.A)(),{upsertSnapchatConfig:n,loading:o}=N(s,t),i=v.nP?.setupComplete?"reconnect":"setup-snapchat",d={next_page_name:i},u=(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,d),[_,{loading:g,data:j}]=(0,f.A)({path:u});(0,r.useEffect)(()=>{s&&n(s)},[s,t,n]);return(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,disabled:e,description:(0,a.__)("Connect your Snapchat Business Account to sync your catalog and run Dynamic Ads.","snapchat-for-woocommerce"),indicator:o?(0,p.jsx)(h.A,{loading:!0,text:(0,a.__)("Connecting…","snapchat-for-woocommerce")}):(0,p.jsx)(h.A,{isSecondary:!0,disabled:e,loading:g||j,eventName:"sfw_snapchat_account_connect_button_click",eventProps:{context:i},onClick:async()=>{try{const e=await _();window.location.href=e.url}catch(e){c("error",(0,a.__)("Unable to connect your Snapchat account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,a.__)("Connect","snapchat-for-woocommerce")})})},y=({disabled:e=!1})=>{const{isConnected:s}=(0,n.A)(),{config_id:t,products_token:a}=(0,c.getQuery)();return s?(0,p.jsx)(j,{}):(0,p.jsx)(b,{disabled:e,configId:t,productsToken:a})}}}]);
     1"use strict";(globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[223],{14:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={match:{url:"/snapchat/start"},wpOpenMenu:"toplevel_page_woocommerce-marketing"};function a(){return(0,c.useEffect)(()=>{window.wpNavMenuClassChange(n,n.match.url)})}},873:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getSettings",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui),t=s[a]();return{capiEnabled:t.capiEnabled,collectPii:t.collectPii,shouldTriggerExport:t.triggerExport,lastExportTimeStamp:t.lastExportTimeStamp,exportFileUrl:t.exportFileUrl,hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},1968:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(5703);const n=()=>(0,c.getSetting)("adminUrl")},2224:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8468),n=t(6087);const a=e=>{const s=(0,n.useRef)(e);return(0,c.isEqual)(s.current,e)||(s.current=e),s.current}},2465:(e,s,t)=>{t.d(s,{A:()=>u});var c=t(7723),n=t(6087),a=t(6427),o=t(3905),r=t(8846),i=t(6473),l=t(790);const d=e=>{const{eventName:s,eventProps:t,onClick:c=()=>{},...n}=e;return(0,l.jsx)(r.Link,{...n,onClick:e=>{s&&(0,i.Sf)(s,t),c(e)}})},p=e=>{const{context:s,linkId:t,href:c,...n}=e;return(0,l.jsx)(d,{eventProps:{context:s,link_id:t,href:c},type:"external",target:"_blank",href:c,...n,eventName:"sfw_documentation_link_click"})},u=()=>{const{isLegacyPluginActive:e}=o.nP;return e?(0,l.jsx)(a.Notice,{status:"warning",isDismissible:!1,children:(0,n.createInterpolateElement)((0,c.__)("You currently have two Snapchat plugins installed. Having both plugins active can cause reporting issues. Please uninstall the 'Snapchat Pixel for WooCommerce' (Legacy Plugin) by following the steps <link>here</link>.","snapchat-for-woocommerce"),{link:(0,l.jsx)(p,{context:"legacy-plugin-active-notice",linkId:"legacy-plugin-active-notice",href:"https://woocommerce.com/document/snapchat-for-woocommerce/#section-4"})})}):null}},2482:(e,s,t)=>{t.d(s,{x:()=>p,A:()=>_});var c=t(7723),n=t(6942),a=t.n(n),o=t(8242),r=t(8771);const i=t.p+"images/js/src/images/logo/snapchat.svg",l=t.p+"images/js/src/images/logo/wp.svg";var d=t(790);const p={EMPTY:"empty",WPCOM:"wpcom",SNAPCHAT:"snapchat"},u=(0,d.jsx)("img",{src:i,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),h=(0,d.jsx)("img",{src:l,alt:(0,c.__)("WordPress.com Logo","snapchat-for-woocommerce"),width:"40",height:"40"}),m={[p.EMPTY]:{},[p.WPCOM]:{icon:h,title:"WordPress.com"},[p.SNAPCHAT]:{icon:u,title:(0,c.__)("Snapchat","snapchat-for-woocommerce")}},f={center:!1,top:"sfw-account-card__styled--align-top"},w={...f,toDetail:"sfw-account-card__indicator--align-to-detail"};function _({className:e,disabled:s=!1,appearance:t=p.EMPTY,icon:c=m[t].icon,title:n=m[t].title,description:i=m[t].description,helper:l,alignIcon:u="center",indicator:h,alignIndicator:_="center",detail:x,expandedDetail:g=!1,actions:j,children:v,...A}){const N=a()("sfw-account-card",!!s&&"sfw-account-card--is-disabled",!!g&&"sfw-account-card--is-expanded-detail",e),b=a()("sfw-account-card__icon",f[u]),y=a()("sfw-account-card__indicator",w[_]);return(0,d.jsxs)(o.A.Card,{className:N,...A,children:[(0,d.jsx)(o.A.Card.Body,{children:(0,d.jsxs)("div",{className:"sfw-account-card__body-layout",children:[c&&(0,d.jsx)("div",{className:b,children:c}),(0,d.jsxs)("div",{className:"sfw-account-card__subject",children:[n&&(0,d.jsx)(r.A.Title,{className:"sfw-account-card__title",children:n}),i&&(0,d.jsx)("div",{className:"sfw-account-card__description",children:i}),l&&(0,d.jsx)("div",{className:"sfw-account-card__helper",children:l})]}),x&&(0,d.jsx)("div",{className:"sfw-account-card__detail",children:x}),h&&(0,d.jsx)("div",{className:y,children:h}),j&&(0,d.jsx)("div",{className:"sfw-account-card__actions",children:j})]})}),v]})}},3164:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",title:t,description:n}=e;return(0,c.jsxs)("header",{className:`sfw-step-content-header ${s}`,children:[(0,c.jsx)("h1",{children:t}),(0,c.jsx)("div",{className:"sfw-step-content-header__description",children:n})]})}},3666:(e,s,t)=>{t.d(s,{FN:()=>a,xP:()=>n});var c=t(6476);const n=()=>(0,c.getNewPath)(null,"/snapchat/setup",null),a=()=>(0,c.getNewPath)(null,"/snapchat/settings",null)},3704:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",...t}=e;return(0,c.jsx)("div",{className:`sfw-step-content-actions ${s}`,...t})}},3741:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(7723),a=t(790);const o=()=>(0,a.jsx)("div",{className:"sfw-app-spinner",role:"status","aria-label":(0,n.__)("Loading…","snapchat-for-woocommerce"),children:(0,a.jsx)(c.Spinner,{})})},4566:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6942),n=t.n(c),a=t(7723),o=t(6427),r=t(4848),i=t(790);const l=e=>{const{className:s}=e;return(0,i.jsxs)(o.Flex,{className:n()("sfw-connected-icon-label",s),align:"center",gap:1,children:[(0,i.jsx)(o.FlexItem,{children:(0,i.jsx)(r.A,{})}),(0,i.jsx)(o.FlexItem,{children:(0,a.__)("Connected","snapchat-for-woocommerce")})]})}},4790:(e,s,t)=>{t.d(s,{Ay:()=>w});var c=t(7723);function n(e){return"yes"!==e.active?"":"yes"===e.owner?e.email:(0,c.__)("Successfully connected through Jetpack","snapchat-for-woocommerce")}var a=t(2482),o=t(4566),r=t(790);const i=({jetpack:e})=>(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:n(e),indicator:(0,r.jsx)(o.A,{})});var l=t(3832),d=t(3905),p=t(6520),u=t(7892),h=t(5640),m=t(6599);const f=()=>{const{createNotice:e}=(0,h.A)(),s=d.nP?.setupComplete?"reconnect":"setup-snapchat",t={next_page_name:s},n=(0,l.addQueryArgs)(`${p.RV}/jetpack/connect`,t),[o,{loading:i,data:f}]=(0,m.A)({path:n});return(0,r.jsx)(a.A,{appearance:a.x.WPCOM,description:(0,c.__)("Required to connect with Snapchat","snapchat-for-woocommerce"),indicator:(0,r.jsx)(u.A,{isSecondary:!0,loading:i||f,eventName:"sfw_wordpress_account_connect_button_click",eventProps:{context:s},onClick:async()=>{try{const e=await o();window.location.href=e.url}catch(s){e("error",(0,c.__)("Unable to connect your WordPress.com account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,c.__)("Connect","snapchat-for-woocommerce")})})},w=({jetpack:e})=>"yes"===e.active?(0,r.jsx)(i,{jetpack:e}):(0,r.jsx)(f,{})},5640:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(7143);const n=()=>(0,c.useDispatch)("core/notices")},5659:(e,s,t)=>{t.d(s,{A:()=>u});var c=t(7723),n=t(6427),a=t(6476),o=t(7892),r=t(9457);const i=t.p+"images/js/src/images/logo/woocommerce.svg",l=t.p+"images/js/src/images/logo/snapchat-wide.svg";var d=t(3666),p=t(790);const u=()=>{const e=()=>{(0,a.getHistory)().replace((0,d.FN)())};return(0,p.jsxs)(r.A,{className:"sfw-onboarding-success-modal",onRequestClose:e,buttons:[(0,p.jsx)(o.A,{variant:"secondary",onClick:e,children:(0,c.__)("Close","snapchat-for-woocommerce")},"close")],children:[(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__logos",children:(0,p.jsxs)(n.Flex,{gap:6,align:"center",justify:"center",children:[(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:i,alt:(0,c.__)("WooCommerce Logo","snapchat-for-woocommerce"),width:"187.5"})}),(0,p.jsx)(n.FlexItem,{className:"sfw-onboarding-success-modal__logo-separator-line"}),(0,p.jsx)(n.FlexItem,{children:(0,p.jsx)("img",{src:l,alt:(0,c.__)("Snapchat Logo","snapchat-for-woocommerce"),width:"123"})})]})}),(0,p.jsxs)("div",{className:"sfw-onboarding-success-modal__content",children:[(0,p.jsx)("h2",{className:"sfw-onboarding-success-modal__title",children:(0,c.__)("You’ve successfully set up Snapchat for WooCommerce! 🎉","snapchat-for-woocommerce")}),(0,p.jsx)("div",{className:"sfw-onboarding-success-modal__description",children:(0,c.__)("Your store is now connected to Snapchat. You can start running ads, track performance, and reach Snapchat users with your WooCommerce products.","snapchat-for-woocommerce")})]})]})}},6028:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(3741),n=t(8242),a=t(790);const o=()=>(0,a.jsx)(n.A.Card,{children:(0,a.jsx)(n.A.Card.Body,{children:(0,a.jsx)(c.A,{})})})},6474:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(6087);const n={"full-page":["woocommerce-admin-full-screen","is-wp-toolbar-disabled","sfw-full-page"],"full-content":["sfw-full-content"]};function a(e){(0,c.useEffect)(()=>{if(!n.hasOwnProperty(e))return;const s=document.body.classList,t=n[e].filter(e=>!s.contains(e));return s.add(...t),()=>{s.remove(...t)}},[e])}},6599:(e,s,t)=>{t.d(s,{A:()=>m});var c=t(6087),n=t(1455),a=t.n(n),o=t(2224);const r="START",i="FINISH",l="ERROR",d="RESET",p={loading:!1,error:void 0,data:void 0,response:void 0,options:void 0},u=(e,s)=>{switch(s.type){case r:return{...e,loading:!0,options:s.options};case i:return{...e,loading:!1,data:s.data,response:s.response,options:s.options};case l:return{...e,loading:!1,error:s.error,response:s.response,options:s.options};case d:return s.state}},h=e=>{const{parse:s=!0}=e;return s},m=(e,s=p)=>{const t=(0,o.A)(e),n={...p,...s},[m,f]=(0,c.useReducer)(u,n);return[(0,c.useCallback)(async e=>{const s={...t,...e};f({type:r,options:s});try{const e=await a()({...s,parse:!1}),t=e.clone(),c=t.json&&await t.json();return f({type:i,data:c,response:e,options:s}),h(s)?c:e}catch(e){if("fetch_error"===e.code)throw f({type:l,error:e,response:void 0,options:s}),e;const t=e;let c;try{const e=t.clone();c=e.json?await e.json():new Error("No content body in fetch response.")}catch(e){c=new Error("Error parsing response.")}throw f({type:l,error:c,response:t,options:s}),h(s)?c:t}},[t]),{...m,reset:e=>{f({type:d,state:{...n,...e}})}}]}},7401:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(7143),n=t(6520);const a="getJetpackAccount",o=()=>(0,c.useSelect)(e=>{const s=e(n.Ui);return{jetpack:s[a](),hasFinishedResolution:s.hasFinishedResolution(a,[])}},[])},7539:(e,s,t)=>{t.d(s,{A:()=>o});var c=t(8846),n=t(8687),a=t(790);const o=({title:e,backHref:s,helpButton:t,onBackButtonClick:o})=>(0,a.jsxs)("div",{className:"sfw-stepper-top-bar",children:[(0,a.jsx)(c.Link,{className:"components-button sfw-stepper-top-bar__back-button",href:s,type:"wc-admin",onClick:o,children:(0,a.jsx)(n.A,{})}),(0,a.jsx)("span",{className:"sfw-stepper-top-bar__title",children:e}),t]})},7792:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(9031),n=t(790);const a=({size:e=18})=>(0,n.jsx)(c.A,{className:"sfw-warning-icon",size:e})},7892:(e,s,t)=>{t.d(s,{A:()=>l});var c=t(6427),n=t(8846),a=t(6942),o=t.n(a),r=t(6473),i=t(790);const l=e=>{const{className:s,disabled:t,loading:a,eventName:l,eventProps:d,text:p,onClick:u=()=>{},...h}=e,m=t||a,f=["sfw-app-button",s];let w;return a&&(w=(0,i.jsx)(n.Spinner,{})),p&&(w=(0,i.jsxs)(i.Fragment,{children:[a&&(0,i.jsx)(n.Spinner,{}),p]}),h.icon&&f.push("sfw-app-button--icon-with-text"),"right"===h.iconPosition&&f.push("sfw-app-button--icon-position-right")),(0,i.jsx)(c.Button,{className:o()(...f),disabled:m,"aria-disabled":m,text:w,onClick:(...e)=>{l&&(0,r.Sf)(l,d),u(...e)},...h})}},7952:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6087),a=t(6520),o=t(7162),r=t(2224);const i=()=>((e,...s)=>{const{invalidateResolution:t}=(0,o.j)(),i=(0,r.A)(s),l=(0,n.useCallback)(()=>{t(e,i)},[t,e,i]);return(0,c.useSelect)(s=>{const{isResolving:t,hasFinishedResolution:c}=s(a.Ui),n=s(a.Ui)[e](...i);return{isResolving:t(e,i),hasFinishedResolution:c(e,i),data:n,invalidateResolution:l}},[l,e,i])})("getSetup")},8242:(e,s,t)=>{t.d(s,{A:()=>d});var c=t(6942),n=t.n(c),a=t(6427),o=t(790);var r=t(8771);const i=({size:e="",...s})=>(0,o.jsx)(a.Card,{...s,size:e});i.Body=e=>{const{className:s,...t}=e;return(0,o.jsx)(a.CardBody,{className:n()("sfw-section-card-body",s),...t})},i.Footer=e=>{const{children:s,...t}=e;return(0,o.jsx)(a.CardFooter,{className:"sfw-section-card-footer",...t,children:s})},i.Title=e=>{const{className:s,...t}=e;return(0,o.jsx)(r.A.Title,{className:n()("sfw-section-card-title",s),...t})};const l=({className:e,title:s,description:t,topContent:c,children:r,disabled:i,disabledLeft:l,verticalGap:d=6})=>{const p=n()("sfw-section",!!i&&"sfw-section--is-disabled",!!l&&"sfw-section--is-disabled-left",e);return(0,o.jsxs)("section",{className:p,children:[(c||s||t)&&(0,o.jsxs)("header",{className:"sfw-section__header",children:[c&&(0,o.jsx)("p",{children:c}),s&&(0,o.jsx)("h1",{children:s}),t]}),(0,o.jsx)(a.Flex,{className:"sfw-section__body",direction:"column",gap:d,children:r})]})};l.Card=i;const d=l},8523:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(7143),n=t(6520),a=t(3905),o=t(7952);const r="getSnapchatAccount",i=()=>{const{data:e}=(0,o.A)(),s=e?.status===a.Dh.CONNECTED;return(0,c.useSelect)(e=>{const t=e(n.Ui),c=t[r]();return{status:c?.status,isConnected:c?.status===a.C5.CONNECTED&&s,hasFinishedResolution:t.hasFinishedResolution(r,[])}},[s])}},8771:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(6942),n=t.n(c),a=t(790);const o=e=>{const{className:s="",...t}=e;return(0,a.jsx)("div",{className:`sfw-subsection ${s}`,...t})};o.Title=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-title",s),...t})},o.Subtitle=e=>{const{className:s,...t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-subtitle",s),...t})},o.Body=e=>{const{children:s}=e;return(0,a.jsx)("div",{className:"sfw-subsection-body",children:s})},o.HelperText=e=>{const{className:s,children:t}=e;return(0,a.jsx)("div",{className:n()("sfw-subsection-helper-text",s),children:t})};const r=o},9180:(e,s,t)=>{t.d(s,{A:()=>r});var c=t(7723),n=t(4236),a=t(7892),o=t(790);const r=({eventContext:e})=>(0,o.jsxs)(a.A,{className:"sfw-help-icon-button",href:"https://woocommerce.com/document/snapchat-for-woocommerce/",target:"_blank",eventName:"sfw_help_click",eventProps:{context:e},children:[(0,o.jsx)(n.A,{}),(0,c.__)("Help","snapchat-for-woocommerce")]})},9370:(e,s,t)=>{t.d(s,{A:()=>n});var c=t(790);const n=e=>{const{className:s="",children:t,...n}=e;return(0,c.jsx)("div",{className:`sfw-step-content ${s}`,...n,children:(0,c.jsx)("div",{className:"sfw-step-content__container",children:t})})}},9457:(e,s,t)=>{t.d(s,{A:()=>i});var c=t(6427),n=t(6942),a=t.n(n),o=t(790);const r={auto:!1,visible:"swf-app-modal__styled--overflow-visible"},i=({className:e,overflow:s="auto",buttons:t=[],children:n,...i})=>{const l=a()("sfw-admin-page","sfw-app-modal",r[s],e);return(0,o.jsxs)(c.Modal,{className:l,...i,children:[n,t.length>=1&&(0,o.jsx)("div",{className:"sfw-app-modal__footer",children:t})]})}},9826:(e,s,t)=>{t.d(s,{A:()=>a});var c=t(8242),n=t(790);const a=({children:e})=>(0,n.jsx)(c.A,{className:"sfw-step-content-footer",verticalGap:10,children:e})},9956:(e,s,t)=>{t.d(s,{L4:()=>j,Ay:()=>y});var c=t(6476),n=t(8523),a=t(7723),o=t(7143),r=t(6087),i=t(7162),l=t(6520);const d="getSnapchatAccountDetails";var p=t(790);const u=()=>{const{org_name:e,ad_acc_id:s,ad_acc_name:t,pixel_id:c}=(()=>{const e=(0,i.j)(),s=(0,r.useCallback)(()=>{e.invalidateResolution(d,[])},[e]);return(0,o.useSelect)(e=>{const t=e(l.Ui);return{...t[d](),refetchSnapchatAccountDetails:s,hasFinishedResolution:t.hasFinishedResolution(d,[])}},[s])})();return(0,p.jsxs)("div",{className:"sfw-snapchat-account-details",children:[e&&(0,p.jsxs)("p",{children:[(0,a.__)("Organization:","snapchat-for-woocommerce")," ",e]}),s&&t&&(0,p.jsxs)("p",{children:[(0,a.__)("Ads Account:","snapchat-for-woocommerce")," ",t," (",s,")"]}),c&&(0,p.jsxs)("p",{children:[(0,a.__)("Pixel ID:","snapchat-for-woocommerce")," ",c]})]})};var h=t(7892),m=t(3832),f=t(6599),w=t(5640);const _=({text:e=(0,a.__)("Or, connect to a different Snapchat account","snapchat-for-woocommerce"),...s})=>{const[t,{loading:c}]=(()=>{const{createNotice:e,removeNotice:s}=(0,w.A)(),{disconnectSnapchatAccount:t}=(0,i.j)(),[c,n]=(0,r.useState)(!1),[o,{loading:d,data:p}]=function(e){const s=(0,r.useMemo)(()=>{const s={next_page_name:e};return{path:(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,s)}},[e]);return(0,f.A)(s)}("setup-snapchat");return[async()=>{const{notice:c}=await e("info",(0,a.__)("Connecting to a different Snapchat account, please wait…","snapchat-for-woocommerce"));n(!0);try{await t();const{url:e}=await o();e&&(window.location.href=e)}catch(t){s(c.id),e("error",(0,a.__)("Unable to connect to a different Snapchat account. Please try again later.","snapchat-for-woocommerce"))}finally{n(!1)}},{loading:c||d||p}]})();return(0,p.jsx)(h.A,{isLink:!0,disabled:c,text:e,eventName:"sfw_snapchat_account_connect_different_account_button_click",onClick:t,...s})};var x=t(2482),g=t(4566);const j=({hideAccountSwitch:e=!1,children:s})=>(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,description:(0,p.jsx)(u,{}),indicator:(0,p.jsx)(g.A,{}),actions:e?null:(0,p.jsx)(_,{isTertiary:!0}),children:s});var v=t(3905),A=t(3666);const N=(e,s)=>{const{createNotice:t}=(0,w.A)(),{fetchSnapchatAccount:n,fetchSetup:a}=(0,i.j)(),[o,d]=(0,r.useState)(!1),[p]=(0,f.A)({path:`${l.RV}/snapchat/config`,method:"POST",data:{id:e,products_token:s}});return{upsertSnapchatConfig:(0,r.useCallback)(async()=>{if(!e||!s)return!1;d(!0);try{await p({parse:!1})}catch(e){t("error",e.message)}await n(),await a(),(0,c.getHistory)().replace((0,A.xP)()),d(!1)},[t,p,n,a,e,s]),loading:o}},b=({disabled:e,configId:s,productsToken:t})=>{const{createNotice:c}=(0,w.A)(),{upsertSnapchatConfig:n,loading:o}=N(s,t),i=v.nP?.setupComplete?"reconnect":"setup-snapchat",d={next_page_name:i},u=(0,m.addQueryArgs)(`${l.RV}/snapchat/connect`,d),[_,{loading:g,data:j}]=(0,f.A)({path:u});(0,r.useEffect)(()=>{s&&n(s)},[s,t,n]);return(0,p.jsx)(x.A,{appearance:x.x.SNAPCHAT,disabled:e,description:(0,a.__)("Connect your Snapchat Business Account to sync your catalog and run Dynamic Ads.","snapchat-for-woocommerce"),indicator:o?(0,p.jsx)(h.A,{loading:!0,text:(0,a.__)("Connecting…","snapchat-for-woocommerce")}):(0,p.jsx)(h.A,{isSecondary:!0,disabled:e,loading:g||j,eventName:"sfw_snapchat_account_connect_button_click",eventProps:{context:i},onClick:async()=>{try{const e=await _();window.location.href=e.url}catch(e){c("error",(0,a.__)("Unable to connect your Snapchat account. Please try again later.","snapchat-for-woocommerce"))}},children:(0,a.__)("Connect","snapchat-for-woocommerce")})})},y=({disabled:e=!1})=>{const{isConnected:s}=(0,n.A)(),{config_id:t,products_token:a}=(0,c.getQuery)();return s?(0,p.jsx)(j,{}):(0,p.jsx)(b,{disabled:e,configId:t,productsToken:a})}}}]);
  • snapchat-for-woocommerce/trunk/js/build/index.asset.php

    r3368691 r3408534  
    1 <?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wc-components', 'wc-navigation', 'wc-settings', 'wc-tracks', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-url'), 'version' => '60bfb8bebe7e0268daeb');
     1<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wc-components', 'wc-navigation', 'wc-settings', 'wc-tracks', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-url'), 'version' => '64ba4abdecf54c10414f');
  • snapchat-for-woocommerce/trunk/js/build/index.js

    r3368691 r3408534  
    1 (()=>{"use strict";var e,t,n={790:e=>{e.exports=window.ReactJSXRuntime},1455:e=>{e.exports=window.wp.apiFetch},1609:e=>{e.exports=window.React},3832:e=>{e.exports=window.wp.url},3905:(e,t,n)=>{n.d(t,{C5:()=>a,Dh:()=>r,nP:()=>o});const o=window.snapchatAdsAdminData,a={CONNECTED:"connected",DISCONNECTED:"disconnected"},r={CONNECTED:"connected",DISCONNECTED:"disconnected"}},5703:e=>{e.exports=window.wc.wcSettings},6087:e=>{e.exports=window.wp.element},6427:e=>{e.exports=window.wp.components},6473:(e,t,n)=>{n.d(t,{qX:()=>p,Rv:()=>d,Sf:()=>u,T:()=>i});var o=n(7143),a=n(8468);const r=window.wc.tracks;var c=n(3905),s=n(7162);const i=a.noop;function p(e){const{slug:t}=c.nP,{version:n,adAccountId:a}=(0,o.select)(s.U).getGeneral(),r={...e,[`${t}_version`]:n};return a&&(r[`${t}_ads_id`]=a),r}function u(e,t){(0,r.recordEvent)(e,p(t))}function d(e,t){(0,r.queueRecordEvent)(e,p(t))}},6476:e=>{e.exports=window.wc.navigation},6520:(e,t,n)=>{n.d(t,{RV:()=>a,Ui:()=>o,mY:()=>r});const o="wc/sfw",a="/wc/sfw",r="core/notices"},7143:e=>{e.exports=window.wp.data},7162:(e,t,n)=>{n.d(t,{U:()=>i.Ui,j:()=>L});var o={};n.r(o),n.d(o,{disconnectSnapchatAccount:()=>A,fetchSetup:()=>T,fetchSnapchatAccount:()=>S,receiveJetpackAccount:()=>m,receiveSettings:()=>f,receiveSetup:()=>C,receiveSnapchatAccount:()=>E,receiveSnapchatAccountDetails:()=>g,receiveTrackConversionsStatus:()=>_,updateSettings:()=>w});var a={};n.r(a),n.d(a,{getGeneral:()=>y,getJetpackAccount:()=>N,getSettings:()=>O,getSetup:()=>v,getSnapchatAccount:()=>b,getSnapchatAccountDetails:()=>I});var r={};n.r(r),n.d(r,{getJetpackAccount:()=>P,getSettings:()=>x,getSetup:()=>V,getSnapchatAccount:()=>R,getSnapchatAccountDetails:()=>U});var c=n(7143),s=n(3905),i=n(6520),p=n(7723),u=n(1455),d=n.n(u);function l(e,t,n){if(401!==e?.statusCode){const o=function(e,t,n){const o=[],a=e?.message;return t&&o.push(t),a&&"string"==typeof a?o.push(a):n&&o.push(n),0===o.length&&o.push((0,p.__)("Unknown error occurred.","snapchat-for-woocommerce")),o.join((0,p._x)(" ","The spacing between sentences. It's a space in English. Please use an empty string if no spacing is needed in that language.","snapchat-for-woocommerce"))}(e,t,n);(0,c.dispatch)(i.mY).createNotice("error",o)}console.error(e)}const h={RECEIVE_ACCOUNTS_JETPACK:"RECEIVE_ACCOUNTS_JETPACK",RECEIVE_SNAPCHAT_ACCOUNT:"RECEIVE_SNAPCHAT_ACCOUNT",RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:"RECEIVE_SNAPCHAT_ACCOUNT_DETAILS",RECEIVE_TRACK_CONVERSIONS_STATUS:"RECEIVE_TRACK_CONVERSIONS_STATUS",RECEIVE_SETUP:"RECEIVE_SETUP",RECEIVE_SETTINGS:"RECEIVE_SETTINGS",DISCONNECT_ACCOUNTS_SNAPCHAT:"DISCONNECT_ACCOUNTS_SNAPCHAT",DISCONNECT_ACCOUNTS_ALL:"DISCONNECT_ACCOUNTS_ALL"};function m(e){return{type:h.RECEIVE_ACCOUNTS_JETPACK,account:e}}function E(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT,snapchatAccount:e}}function _(e){return{type:h.RECEIVE_TRACK_CONVERSIONS_STATUS,status:e}}function C(e){return{type:h.RECEIVE_SETUP,setup:e}}function f(e){return{type:h.RECEIVE_SETTINGS,settings:e}}function g(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS,snapchatAccountDetails:e}}async function w(e){try{const t=await d()({path:`${i.RV}/snapchat/settings`,method:"POST",data:{capi_enabled:e.capiEnabled,collect_pii:e.collectPii}});return f({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url})}catch(e){throw l(e,(0,p.__)("There was an error updating the settings.","snapchat-for-woocommerce")),e}}async function S(){try{const e=await d()({path:`${i.RV}/snapchat/connection`});(0,c.dispatch)(i.Ui).receiveSnapchatAccount(e)}catch(e){l(e,(0,p.__)("There was an error loading Snapchat account info.","snapchat-for-woocommerce"))}}async function T(){try{const e=await d()({path:`${i.RV}/snapchat/setup`});(0,c.dispatch)(i.Ui).receiveSetup(e)}catch(e){l(e,(0,p.__)("There was an error loading Snapchat setup.","snapchat-for-woocommerce"))}}async function A(e=!1){try{return await d()({path:`${i.RV}/snapchat/connection`,method:"DELETE"}),{type:h.DISCONNECT_ACCOUNTS_SNAPCHAT,invalidateRelatedState:e}}catch(e){throw l(e,(0,p.__)("Unable to disconnect your Snapchat account.","snapchat-for-woocommerce")),e}}const v=e=>e.setup,N=e=>e.accounts.jetpack,b=e=>e.accounts.snapchat,y=e=>e.general,I=e=>e.snapchat,O=e=>e.settings;function P(){return async function({dispatch:e}){try{e(m(await d()({path:`${i.RV}/jetpack/connected`})))}catch(e){l(e,(0,p.__)("There was an error loading Jetpack account info.","snapchat-for-woocommerce"))}}}function R(){return S}function U(){return async function({dispatch:e}){try{e(g(await d()({path:`${i.RV}/snapchat/account`})))}catch(e){l(e,(0,p.__)("There was an error loading Snapchat account details info.","snapchat-for-woocommerce"))}}}function x(){return async function({dispatch:e}){try{const t=await d()({path:`${i.RV}/snapchat/settings`});e(f({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url}))}catch(e){l(e,(0,p.__)("There was an error fetching settings.","snapchat-for-woocommerce"))}}}function V(){return T}var k=n(8468);function D(e,t,n){return function(e,t=""){const n=Object.assign(e.constructor(),e),o=e=>null==e?{}:(0,k.clone)(e);return{setIn(e,a){const r=(e=>t?Array.isArray(t)||Array.isArray(e)?[].concat(t,e):`${t}.${e}`:e)(e);return(0,k.setWith)(n,r,a,o),this},end:()=>n}}(e).setIn(t,n).end()}const j=(0,c.createReduxStore)(i.Ui,{actions:o,selectors:a,resolvers:r,reducer:(e,t)=>{switch(t.type){case h.RECEIVE_ACCOUNTS_JETPACK:{const{account:n}=t;return D(e,"accounts.jetpack",n)}case h.RECEIVE_SETUP:{const{setup:n}=t;return D(e,"setup",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT:{const{snapchatAccount:n}=t;return D(e,"accounts.snapchat",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:{const{snapchatAccountDetails:n}=t;return D(e,"snapchat",n)}case h.DISCONNECT_ACCOUNTS_SNAPCHAT:return D(e,"accounts.snapchat",null);case h.RECEIVE_SETTINGS:{const{settings:n}=t;return D(e,"settings",n)}case h.DISCONNECT_ACCOUNTS_ALL:default:return e}},initialState:{general:{version:s.nP.pluginVersion,adAccountId:s.nP.adAccountId},setup:{status:s.nP.status,step:s.nP.step},accounts:{jetpack:null,snapchat:null},snapchat:null,settings:{capiEnabled:!1,collectPii:!0,triggerExport:!1,lastExportTimeStamp:"",exportFileUrl:""}}});(0,c.register)(j);const L=()=>(0,c.useDispatch)(i.Ui)},7723:e=>{e.exports=window.wp.i18n},8468:e=>{e.exports=window.lodash},8846:e=>{e.exports=window.wc.components}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>({207:"get-started-page",223:"commons",352:"onboarding",472:"settings"}[e]+".js?ver="+{207:"dd28af6dd94cd7e7cfae",223:"28ee55793c55b7ee94b6",352:"e1bd35623cbd93fc707d",472:"fd1f8446e705b19d4dd6"}[e]),a.miniCssF=e=>({352:"onboarding",472:"settings"}[e]+".css?ver="+{352:"e1bd35623cbd93fc707d",472:"fd1f8446e705b19d4dd6"}[e]),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="snapchat-for-woocommerce:",a.l=(n,o,r,c)=>{if(e[n])e[n].push(o);else{var s,i;if(void 0!==r)for(var p=document.getElementsByTagName("script"),u=0;u<p.length;u++){var d=p[u];if(d.getAttribute("src")==n||d.getAttribute("data-webpack")==t+r){s=d;break}}s||(i=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",t+r),s.src=n),e[n]=[o];var l=(t,o)=>{s.onerror=s.onload=null,clearTimeout(h);var a=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),a&&a.forEach(e=>e(o)),t)return t(o)},h=setTimeout(l.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=l.bind(null,s.onerror),s.onload=l.bind(null,s.onload),i&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{if("undefined"!=typeof document){var e={57:0};a.f.miniCss=(t,n)=>{e[t]?n.push(e[t]):0!==e[t]&&{352:1,472:1}[t]&&n.push(e[t]=(e=>new Promise((t,n)=>{var o=a.miniCssF(e),r=a.p+o;if(((e,t)=>{for(var n=document.getElementsByTagName("link"),o=0;o<n.length;o++){var a=(c=n[o]).getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(a===e||a===t))return c}var r=document.getElementsByTagName("style");for(o=0;o<r.length;o++){var c;if((a=(c=r[o]).getAttribute("data-href"))===e||a===t)return c}})(o,r))return t();((e,t,n,o,r)=>{var c=document.createElement("link");c.rel="stylesheet",c.type="text/css",a.nc&&(c.nonce=a.nc),c.onerror=c.onload=n=>{if(c.onerror=c.onload=null,"load"===n.type)o();else{var a=n&&n.type,s=n&&n.target&&n.target.href||t,i=new Error("Loading CSS chunk "+e+" failed.\n("+a+": "+s+")");i.name="ChunkLoadError",i.code="CSS_CHUNK_LOAD_FAILED",i.type=a,i.request=s,c.parentNode&&c.parentNode.removeChild(c),r(i)}},c.href=t,document.head.appendChild(c)})(e,r,0,t,n)}))(t).then(()=>{e[t]=0},n=>{throw delete e[t],n}))}}})(),(()=>{var e={57:0};a.f.j=(t,n)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise((n,a)=>o=e[t]=[n,a]);n.push(o[2]=r);var c=a.p+a.u(t),s=new Error;a.l(c,n=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),c=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+r+": "+c+")",s.name="ChunkLoadError",s.type=r,s.request=c,o[1](s)}},"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[c,s,i]=n,p=0;if(c.some(t=>0!==e[t])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);i&&i(a)}for(t&&t(n);p<c.length;p++)r=c[p],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=a(7723),c=a(6087);const s=window.wp.hooks;var i=a(5703);a(7162);const p=window.wp.compose;var u=a(790);const d=(0,p.createHigherOrderComponent)(e=>t=>(0,u.jsx)("div",{className:"sfw-admin-page",children:(0,u.jsx)(e,{...t})}),"withAdminPageShell");var l=a(6473);const h=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(207)]).then(a.bind(a,9484))),m=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(352)]).then(a.bind(a,8481))),E=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(472)]).then(a.bind(a,8052))),_=new Set,C=(0,i.getSetting)("admin")?.woocommerceTranslation||(0,r.__)("WooCommerce","snapchat-for-woocommerce"),f="woocommerce_admin_pages_list";let g=!1;const w=()=>{(0,s.addFilter)(f,"woocommerce/snapchat-for-woo/add-page-routes",e=>{const t=[["",C],["/marketing",(0,r.__)("Marketing","snapchat-for-woocommerce")],(0,r.__)("Snapchat for WooCommerce","snapchat-for-woocommerce")],n=[{breadcrumbs:[...t],container:h,path:"/snapchat/start",wpOpenMenu:"toplevel_page_woocommerce-marketing"},{breadcrumbs:[...t,(0,r.__)("Setup Snapchat","snapchat-for-woocommerce")],container:m,path:"/snapchat/setup"},{breadcrumbs:[...t,(0,r.__)("Settings","snapchat-for-woocommerce")],container:E,path:"/snapchat/settings",wpOpenMenu:"toplevel_page_woocommerce-marketing"}];return n.forEach(e=>{e.container=d(e.container);const t=e.path.substring(1).replace(/\//g,"_");_.add(t)}),g=!0,e.concat(n)})},S=()=>(0,s.hasAction)("hookAdded",`woocommerce/woocommerce/watch_${f}`);if((0,s.didFilter)(f)>0&&!S()&&!g){const e=Date.now(),t=setInterval(()=>{if(S())return clearInterval(t),void w();Date.now()-e>3e3&&clearInterval(t)},10)}else w();(0,s.addFilter)("woocommerce_tracks_client_event_properties","woocommerce/snapchat-for-woo/add-base-event-properties-to-page-view",(e,t)=>"wcadmin_page_view"===t&&_.has(e.path)?(0,l.qX)(e):e)})();
     1(()=>{"use strict";var e,t,n={790:e=>{e.exports=window.ReactJSXRuntime},1455:e=>{e.exports=window.wp.apiFetch},1609:e=>{e.exports=window.React},3832:e=>{e.exports=window.wp.url},3905:(e,t,n)=>{n.d(t,{C5:()=>a,Dh:()=>r,nP:()=>o});const o=window.snapchatAdsAdminData,a={CONNECTED:"connected",DISCONNECTED:"disconnected"},r={CONNECTED:"connected",DISCONNECTED:"disconnected"}},5703:e=>{e.exports=window.wc.wcSettings},6087:e=>{e.exports=window.wp.element},6427:e=>{e.exports=window.wp.components},6473:(e,t,n)=>{n.d(t,{qX:()=>p,Rv:()=>l,Sf:()=>u,T:()=>i});var o=n(7143),a=n(8468);const r=window.wc.tracks;var c=n(3905),s=n(7162);const i=a.noop;function p(e){const{slug:t}=c.nP,{version:n,adAccountId:a}=(0,o.select)(s.U).getGeneral(),r={...e,[`${t}_version`]:n};return a&&(r[`${t}_ads_id`]=a),r}function u(e,t){(0,r.recordEvent)(e,p(t))}function l(e,t){(0,r.queueRecordEvent)(e,p(t))}},6476:e=>{e.exports=window.wc.navigation},6520:(e,t,n)=>{n.d(t,{RV:()=>a,Ui:()=>o,mY:()=>r});const o="wc/sfw",a="/wc/sfw",r="core/notices"},7143:e=>{e.exports=window.wp.data},7162:(e,t,n)=>{n.d(t,{U:()=>i.Ui,j:()=>L});var o={};n.r(o),n.d(o,{disconnectSnapchatAccount:()=>A,fetchSetup:()=>T,fetchSnapchatAccount:()=>S,receiveJetpackAccount:()=>m,receiveSettings:()=>C,receiveSetup:()=>_,receiveSnapchatAccount:()=>f,receiveSnapchatAccountDetails:()=>g,receiveTrackConversionsStatus:()=>E,updateSettings:()=>w});var a={};n.r(a),n.d(a,{getGeneral:()=>y,getJetpackAccount:()=>N,getSettings:()=>O,getSetup:()=>v,getSnapchatAccount:()=>b,getSnapchatAccountDetails:()=>I});var r={};n.r(r),n.d(r,{getJetpackAccount:()=>P,getSettings:()=>x,getSetup:()=>V,getSnapchatAccount:()=>R,getSnapchatAccountDetails:()=>U});var c=n(7143),s=n(3905),i=n(6520),p=n(7723),u=n(1455),l=n.n(u);function d(e,t,n){if(401!==e?.statusCode){const o=function(e,t,n){const o=[],a=e?.message;return t&&o.push(t),a&&"string"==typeof a?o.push(a):n&&o.push(n),0===o.length&&o.push((0,p.__)("Unknown error occurred.","snapchat-for-woocommerce")),o.join((0,p._x)(" ","The spacing between sentences. It's a space in English. Please use an empty string if no spacing is needed in that language.","snapchat-for-woocommerce"))}(e,t,n);(0,c.dispatch)(i.mY).createNotice("error",o)}console.error(e)}const h={RECEIVE_ACCOUNTS_JETPACK:"RECEIVE_ACCOUNTS_JETPACK",RECEIVE_SNAPCHAT_ACCOUNT:"RECEIVE_SNAPCHAT_ACCOUNT",RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:"RECEIVE_SNAPCHAT_ACCOUNT_DETAILS",RECEIVE_TRACK_CONVERSIONS_STATUS:"RECEIVE_TRACK_CONVERSIONS_STATUS",RECEIVE_SETUP:"RECEIVE_SETUP",RECEIVE_SETTINGS:"RECEIVE_SETTINGS",DISCONNECT_ACCOUNTS_SNAPCHAT:"DISCONNECT_ACCOUNTS_SNAPCHAT",DISCONNECT_ACCOUNTS_ALL:"DISCONNECT_ACCOUNTS_ALL"};function m(e){return{type:h.RECEIVE_ACCOUNTS_JETPACK,account:e}}function f(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT,snapchatAccount:e}}function E(e){return{type:h.RECEIVE_TRACK_CONVERSIONS_STATUS,status:e}}function _(e){return{type:h.RECEIVE_SETUP,setup:e}}function C(e){return{type:h.RECEIVE_SETTINGS,settings:e}}function g(e){return{type:h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS,snapchatAccountDetails:e}}async function w(e){try{const t=await l()({path:`${i.RV}/snapchat/settings`,method:"POST",data:{capi_enabled:e.capiEnabled,collect_pii:e.collectPii}});return C({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url})}catch(e){throw d(e,(0,p.__)("There was an error updating the settings.","snapchat-for-woocommerce")),e}}async function S(){try{const e=await l()({path:`${i.RV}/snapchat/connection`});(0,c.dispatch)(i.Ui).receiveSnapchatAccount(e)}catch(e){d(e,(0,p.__)("There was an error loading Snapchat account info.","snapchat-for-woocommerce"))}}async function T(){try{const e=await l()({path:`${i.RV}/snapchat/setup`});(0,c.dispatch)(i.Ui).receiveSetup(e)}catch(e){d(e,(0,p.__)("There was an error loading Snapchat setup.","snapchat-for-woocommerce"))}}async function A(e=!1){try{return await l()({path:`${i.RV}/snapchat/connection`,method:"DELETE"}),{type:h.DISCONNECT_ACCOUNTS_SNAPCHAT,invalidateRelatedState:e}}catch(e){throw d(e,(0,p.__)("Unable to disconnect your Snapchat account.","snapchat-for-woocommerce")),e}}const v=e=>e.setup,N=e=>e.accounts.jetpack,b=e=>e.accounts.snapchat,y=e=>e.general,I=e=>e.snapchat,O=e=>e.settings;function P(){return async function({dispatch:e}){try{e(m(await l()({path:`${i.RV}/jetpack/connected`})))}catch(e){d(e,(0,p.__)("There was an error loading Jetpack account info.","snapchat-for-woocommerce"))}}}function R(){return S}function U(){return async function({dispatch:e}){try{e(g(await l()({path:`${i.RV}/snapchat/account`})))}catch(e){d(e,(0,p.__)("There was an error loading Snapchat account details info.","snapchat-for-woocommerce"))}}}function x(){return async function({dispatch:e}){try{const t=await l()({path:`${i.RV}/snapchat/settings`});e(C({capiEnabled:Boolean(t.capi_enabled),collectPii:Boolean(t.collect_pii),triggerExport:Boolean(t.trigger_export),lastExportTimeStamp:t.last_export_timestamp,exportFileUrl:t.export_file_url}))}catch(e){d(e,(0,p.__)("There was an error fetching settings.","snapchat-for-woocommerce"))}}}function V(){return T}var k=n(8468);function D(e,t,n){return function(e,t=""){const n=Object.assign(e.constructor(),e),o=e=>null==e?{}:(0,k.clone)(e);return{setIn(e,a){const r=(e=>t?Array.isArray(t)||Array.isArray(e)?[].concat(t,e):`${t}.${e}`:e)(e);return(0,k.setWith)(n,r,a,o),this},end:()=>n}}(e).setIn(t,n).end()}const j=(0,c.createReduxStore)(i.Ui,{actions:o,selectors:a,resolvers:r,reducer:(e,t)=>{switch(t.type){case h.RECEIVE_ACCOUNTS_JETPACK:{const{account:n}=t;return D(e,"accounts.jetpack",n)}case h.RECEIVE_SETUP:{const{setup:n}=t;return D(e,"setup",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT:{const{snapchatAccount:n}=t;return D(e,"accounts.snapchat",n)}case h.RECEIVE_SNAPCHAT_ACCOUNT_DETAILS:{const{snapchatAccountDetails:n}=t;return D(e,"snapchat",n)}case h.DISCONNECT_ACCOUNTS_SNAPCHAT:return D(e,"accounts.snapchat",null);case h.RECEIVE_SETTINGS:{const{settings:n}=t;return D(e,"settings",n)}case h.DISCONNECT_ACCOUNTS_ALL:default:return e}},initialState:{general:{version:s.nP.pluginVersion,adAccountId:s.nP.adAccountId},setup:{status:s.nP.status,step:s.nP.step},accounts:{jetpack:null,snapchat:null},snapchat:null,settings:{capiEnabled:!1,collectPii:!0,triggerExport:!1,lastExportTimeStamp:"",exportFileUrl:""}}});(0,c.register)(j);const L=()=>(0,c.useDispatch)(i.Ui)},7723:e=>{e.exports=window.wp.i18n},8468:e=>{e.exports=window.lodash},8846:e=>{e.exports=window.wc.components}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>({207:"get-started-page",223:"commons",352:"onboarding",472:"settings"}[e]+".js?ver="+{207:"dd28af6dd94cd7e7cfae",223:"2c49a44dff67e815f1d7",352:"b44c93c3f7ac41effb6b",472:"1e0e847f8ffc27511c69"}[e]),a.miniCssF=e=>({352:"onboarding",472:"settings"}[e]+".css?ver="+{352:"b44c93c3f7ac41effb6b",472:"1e0e847f8ffc27511c69"}[e]),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="snapchat-for-woocommerce:",a.l=(n,o,r,c)=>{if(e[n])e[n].push(o);else{var s,i;if(void 0!==r)for(var p=document.getElementsByTagName("script"),u=0;u<p.length;u++){var l=p[u];if(l.getAttribute("src")==n||l.getAttribute("data-webpack")==t+r){s=l;break}}s||(i=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",t+r),s.src=n),e[n]=[o];var d=(t,o)=>{s.onerror=s.onload=null,clearTimeout(h);var a=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),a&&a.forEach(e=>e(o)),t)return t(o)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),i&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{if("undefined"!=typeof document){var e={57:0};a.f.miniCss=(t,n)=>{e[t]?n.push(e[t]):0!==e[t]&&{352:1,472:1}[t]&&n.push(e[t]=(e=>new Promise((t,n)=>{var o=a.miniCssF(e),r=a.p+o;if(((e,t)=>{for(var n=document.getElementsByTagName("link"),o=0;o<n.length;o++){var a=(c=n[o]).getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(a===e||a===t))return c}var r=document.getElementsByTagName("style");for(o=0;o<r.length;o++){var c;if((a=(c=r[o]).getAttribute("data-href"))===e||a===t)return c}})(o,r))return t();((e,t,n,o,r)=>{var c=document.createElement("link");c.rel="stylesheet",c.type="text/css",a.nc&&(c.nonce=a.nc),c.onerror=c.onload=n=>{if(c.onerror=c.onload=null,"load"===n.type)o();else{var a=n&&n.type,s=n&&n.target&&n.target.href||t,i=new Error("Loading CSS chunk "+e+" failed.\n("+a+": "+s+")");i.name="ChunkLoadError",i.code="CSS_CHUNK_LOAD_FAILED",i.type=a,i.request=s,c.parentNode&&c.parentNode.removeChild(c),r(i)}},c.href=t,document.head.appendChild(c)})(e,r,0,t,n)}))(t).then(()=>{e[t]=0},n=>{throw delete e[t],n}))}}})(),(()=>{var e={57:0};a.f.j=(t,n)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise((n,a)=>o=e[t]=[n,a]);n.push(o[2]=r);var c=a.p+a.u(t),s=new Error;a.l(c,n=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),c=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+r+": "+c+")",s.name="ChunkLoadError",s.type=r,s.request=c,o[1](s)}},"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[c,s,i]=n,p=0;if(c.some(t=>0!==e[t])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);i&&i(a)}for(t&&t(n);p<c.length;p++)r=c[p],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=a(7723),c=a(6087);const s=window.wp.hooks;var i=a(5703);a(7162);const p=window.wp.compose;var u=a(790);const l=(0,p.createHigherOrderComponent)(e=>t=>(0,u.jsx)("div",{className:"sfw-admin-page",children:(0,u.jsx)(e,{...t})}),"withAdminPageShell");var d=a(6473);const h=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(207)]).then(a.bind(a,9484))),m=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(352)]).then(a.bind(a,8481))),f=(0,c.lazy)(()=>Promise.all([a.e(223),a.e(472)]).then(a.bind(a,8052))),E=new Set,_=(0,i.getSetting)("admin")?.woocommerceTranslation||(0,r.__)("WooCommerce","snapchat-for-woocommerce"),C="woocommerce_admin_pages_list";let g=!1;const w=()=>{(0,s.addFilter)(C,"woocommerce/snapchat-for-woo/add-page-routes",e=>{const t=[["",_],["/marketing",(0,r.__)("Marketing","snapchat-for-woocommerce")],(0,r.__)("Snapchat for WooCommerce","snapchat-for-woocommerce")],n=[{breadcrumbs:[...t],container:h,path:"/snapchat/start",wpOpenMenu:"toplevel_page_woocommerce-marketing"},{breadcrumbs:[...t,(0,r.__)("Setup Snapchat","snapchat-for-woocommerce")],container:m,path:"/snapchat/setup"},{breadcrumbs:[...t,(0,r.__)("Settings","snapchat-for-woocommerce")],container:f,path:"/snapchat/settings",wpOpenMenu:"toplevel_page_woocommerce-marketing"}];return n.forEach(e=>{e.container=l(e.container);const t=e.path.substring(1).replace(/\//g,"_");E.add(t)}),g=!0,e.concat(n)})},S=()=>(0,s.hasAction)("hookAdded",`woocommerce/woocommerce/watch_${C}`);if((0,s.didFilter)(C)>0&&!S()&&!g){const e=Date.now(),t=setInterval(()=>{if(S())return clearInterval(t),void w();Date.now()-e>3e3&&clearInterval(t)},10)}else w();(0,s.addFilter)("woocommerce_tracks_client_event_properties","woocommerce/snapchat-for-woo/add-base-event-properties-to-page-view",(e,t)=>"wcadmin_page_view"===t&&E.has(e.path)?(0,d.qX)(e):e)})();
  • snapchat-for-woocommerce/trunk/js/build/settings.js

    r3368691 r3408534  
    1 (globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[472],{4848:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-checkmark-circle",s,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658A9.98 9.98 0 0012 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10a9.94 9.94 0 00-.966-4.266L11 17.768z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}},6942:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function c(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return c.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)o.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},8052:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>D});var o=n(7723),c=n(6087),r=n(6476),a=n(14),s=n(8523),i=n(7892),l=n(6028),u=n(8242),d=n(9956),m=n(6427),f=n(9457),h=n(7792),p=n(7162);const _="all-accounts",w="snapchat-account";var g=n(790);const v={[_]:{title:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect all my accounts.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting any WordPress.com account and Snapchat account connected to this extension.","snapchat-for-woocommerce"),(0,o.__)("Lorem ipsum","snapchat-for-woocommerce"),(0,o.__)("Dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.","snapchat-for-woocommerce")]},[w]:{title:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect Snapchat Account","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect my Snapchat account.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting my Snapchat account from this WooCommerce extension.","snapchat-for-woocommerce"),(0,o.__)("Some configurations for Snapchat created through WooCommerce may be lost. This cannot be undone.","snapchat-for-woocommerce")]}};function x({disconnectTarget:e,onRequestClose:t,onDisconnected:n,disconnectAction:r}){const[a,s]=(0,c.useState)(!1),[l,u]=(0,c.useState)(!1),d=(0,p.j)(),{title:w,confirmButton:x,confirmation:y,contents:b}=v[e],j=()=>{l||t()};return(0,g.jsxs)(f.A,{className:"sfw-disconnect-accounts-modal",title:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(h.A,{size:20}),w]}),isDismissible:!l,buttons:[(0,g.jsx)(i.A,{isSecondary:!0,disabled:l,onClick:j,children:(0,o.__)("Never mind","snapchat-for-woocommerce")},"1"),(0,g.jsx)(i.A,{isPrimary:!0,isDestructive:!0,loading:l,disabled:!a,onClick:()=>{let o=e===_?d.disconnectAllAccounts:d.disconnectSnapchatAccount;r&&(o=r),u(!0),o().then(()=>{n(),t()}).catch(()=>{u(!1)})},eventName:"sfw_disconnect_snapchat_confirm_modal_button_click",children:x},"2")],onRequestClose:j,children:[b.map((e,t)=>(0,g.jsx)("p",{children:e},t)),(0,g.jsx)(m.CheckboxControl,{label:y,checked:a,disabled:l,onChange:s})]})}function y(e){return(0,g.jsx)(x,{...e})}var b=n(6473);function j(){const{hasFinishedResolution:e}=(0,s.A)(),[t,n]=(0,c.useState)(null);return(0,g.jsxs)(g.Fragment,{children:[t&&(0,g.jsx)(y,{onRequestClose:()=>n(null),onDisconnected:()=>{(0,b.Rv)("sfw_disconnected_accounts",{context:t}),window.location.reload()},disconnectTarget:t}),!e&&(0,g.jsx)(l.A,{}),e&&(0,g.jsx)(d.L4,{hideAccountSwitch:!0,children:(0,g.jsx)(u.A.Card.Footer,{children:(0,g.jsx)(i.A,{isDestructive:!0,isLink:!0,onClick:()=>n(w),eventName:"sfw_disconnect_snapchat_button_click",children:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce")})})})]})}var C=n(3905),S=n(2482),k=n(873);const{exportNonce:A}=C.nP;var P=n(5640);const{exportNonce:O}=C.nP,E=()=>{const{shouldTriggerExport:e,lastExportTimeStamp:t,exportFileUrl:n,hasFinishedResolution:r}=(0,k.A)(),[a,s]=(0,c.useState)("1"===C.nP.isExportInProgress),[l,u]=(0,c.useState)(C.nP.exportFileUrl||null),[d,f]=(0,c.useState)(C.nP.lastTimestamp||null),h=l&&d,{generateCsv:p}=((e,t)=>{const{createNotice:n}=(0,P.A)();return{generateCsv:(0,c.useCallback)(async()=>{try{const c=await window.jQuery.post(window.ajaxurl,{action:"snapchat_for_woocommerce_generate_feed",security:O});if(c.success)return void e();if(!c.success&&"snapchat_for_woocommerce_no_products_found"===c.data?.code)return void n("error",(0,o.__)("No products found. Please create products to generate the CSV.","snapchat-for-woocommerce"));n("error",(0,o.__)("An error occurred","snapchat-for-woocommerce")),t()}catch(e){n("error",(0,o.sprintf)(
     1(globalThis.webpackChunksnapchat_for_woocommerce=globalThis.webpackChunksnapchat_for_woocommerce||[]).push([[472],{4848:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-checkmark-circle",s,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658A9.98 9.98 0 0012 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10a9.94 9.94 0 00-.966-4.266L11 17.768z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}},6942:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function c(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return c.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)o.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},8052:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>F});var o=n(7723),c=n(6087),r=n(6476),a=n(14),s=n(8523),i=n(7892),l=n(6028),u=n(8242),d=n(9956),m=n(6427),f=n(9457),h=n(7792),p=n(7162);const _="all-accounts",w="snapchat-account";var g=n(790);const v={[_]:{title:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect all accounts","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect all my accounts.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting any WordPress.com account and Snapchat account connected to this extension.","snapchat-for-woocommerce"),(0,o.__)("Lorem ipsum","snapchat-for-woocommerce"),(0,o.__)("Dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.","snapchat-for-woocommerce")]},[w]:{title:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce"),confirmButton:(0,o.__)("Disconnect Snapchat Account","snapchat-for-woocommerce"),confirmation:(0,o.__)("Yes, I want to disconnect my Snapchat account.","snapchat-for-woocommerce"),contents:[(0,o.__)("I understand that I am disconnecting my Snapchat account from this WooCommerce extension.","snapchat-for-woocommerce"),(0,o.__)("Some configurations for Snapchat created through WooCommerce may be lost. This cannot be undone.","snapchat-for-woocommerce")]}};function x({disconnectTarget:e,onRequestClose:t,onDisconnected:n,disconnectAction:r}){const[a,s]=(0,c.useState)(!1),[l,u]=(0,c.useState)(!1),d=(0,p.j)(),{title:w,confirmButton:x,confirmation:y,contents:b}=v[e],j=()=>{l||t()};return(0,g.jsxs)(f.A,{className:"sfw-disconnect-accounts-modal",title:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(h.A,{size:20}),w]}),isDismissible:!l,buttons:[(0,g.jsx)(i.A,{isSecondary:!0,disabled:l,onClick:j,children:(0,o.__)("Never mind","snapchat-for-woocommerce")},"1"),(0,g.jsx)(i.A,{isPrimary:!0,isDestructive:!0,loading:l,disabled:!a,onClick:()=>{let o=e===_?d.disconnectAllAccounts:d.disconnectSnapchatAccount;r&&(o=r),u(!0),o().then(()=>{n(),t()}).catch(()=>{u(!1)})},eventName:"sfw_disconnect_snapchat_confirm_modal_button_click",children:x},"2")],onRequestClose:j,children:[b.map((e,t)=>(0,g.jsx)("p",{children:e},t)),(0,g.jsx)(m.CheckboxControl,{label:y,checked:a,disabled:l,onChange:s})]})}function y(e){return(0,g.jsx)(x,{...e})}var b=n(6473);function j(){const{hasFinishedResolution:e}=(0,s.A)(),[t,n]=(0,c.useState)(null);return(0,g.jsxs)(g.Fragment,{children:[t&&(0,g.jsx)(y,{onRequestClose:()=>n(null),onDisconnected:()=>{(0,b.Rv)("sfw_disconnected_accounts",{context:t}),window.location.reload()},disconnectTarget:t}),!e&&(0,g.jsx)(l.A,{}),e&&(0,g.jsx)(d.L4,{hideAccountSwitch:!0,children:(0,g.jsx)(u.A.Card.Footer,{children:(0,g.jsx)(i.A,{isDestructive:!0,isLink:!0,onClick:()=>n(w),eventName:"sfw_disconnect_snapchat_button_click",children:(0,o.__)("Disconnect Snapchat account","snapchat-for-woocommerce")})})})]})}var C=n(3905),S=n(2482),k=n(873);const{exportNonce:A}=C.nP;var P=n(5640);const{exportNonce:O}=C.nP,E=()=>{const{shouldTriggerExport:e,lastExportTimeStamp:t,exportFileUrl:n,hasFinishedResolution:r}=(0,k.A)(),[a,s]=(0,c.useState)("1"===C.nP.isExportInProgress),[l,u]=(0,c.useState)(C.nP.exportFileUrl||null),[d,f]=(0,c.useState)(C.nP.lastTimestamp||null),h=l&&d,{generateCsv:p}=((e,t)=>{const{createNotice:n}=(0,P.A)();return{generateCsv:(0,c.useCallback)(async()=>{try{const c=await window.jQuery.post(window.ajaxurl,{action:"snapchat_for_woocommerce_generate_feed",security:O});if(c.success)return void e();if(!c.success&&"snapchat_for_woocommerce_no_products_found"===c.data?.code)return void n("error",(0,o.__)("No products found. Please create products to generate the CSV.","snapchat-for-woocommerce"));n("error",(0,o.__)("An error occurred","snapchat-for-woocommerce")),t()}catch(e){n("error",(0,o.sprintf)(
    22// translators: %s: The error message returned from the CSV generation process.
    33// translators: %s: The error message returned from the CSV generation process.
     
    55// translators: %s: The date and time when the product catalog was last exported.
    66// translators: %s: The date and time when the product catalog was last exported.
    7 (0,o.__)("Last exported on %s.","snapchat-for-woocommerce"),d):(0,o.__)("Your product catalog is not synced to Snapchat yet. Generate a CSV to manually upload.","snapchat-for-woocommerce"),indicator:h?(0,g.jsx)(m.Flex,{spacing:4,wrap:"wrap",children:(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_regenerate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Regenerate CSV","snapchat-for-woocommerce")})}):(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_generate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Generate CSV","snapchat-for-woocommerce")}),children:d&&!l&&(0,g.jsx)("div",{className:"sfw-product-catalog__help",children:(0,g.jsx)("p",{children:(0,o.__)('The CSV file may have been deleted and could not be found. Click "Generate CSV" to regenerate a new one.',"snapchat-for-woocommerce")})})})})},I=()=>{const{capiEnabled:e,collectPii:t,hasFinishedResolution:n}=(0,k.A)(),[r,a]=(0,c.useState)(!1),{createNotice:s}=(0,P.A)(),{updateSettings:i}=(0,p.j)(),u=(0,c.useCallback)(async()=>{const{settings:{capiEnabled:t}}=await i({capiEnabled:!e});(0,b.Sf)("sfw_conversion_tracking_toggle",{status:t?"on":"off"})},[i,e]),d=(0,c.useCallback)(async()=>{const{settings:{collectPii:e}}=await i({collectPii:!t});(0,b.Sf)("sfw_collect_pii_toggle",{status:e?"on":"off"})},[i,t]);return n?(0,g.jsx)(S.A,{className:"sfw-settings-track-conversions",title:(0,o.__)("Conversions API","snapchat-for-woocommerce"),description:(0,o.__)("Send server-side conversion events to improve attribution.","snapchat-for-woocommerce"),actions:(0,g.jsxs)("div",{className:"sfw-settings-track-conversions__actions",children:[(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Enable Conversions API tracking","snapchat-for-woocommerce"),checked:e,disabled:r,onChange:async()=>{try{a(!0),await u(),s("success",(0,o.__)("Conversions API Tracking status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}}})}),(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Collect Customer PII","snapchat-for-woocommerce"),checked:t,disabled:r,onChange:async()=>{try{a(!0),await d(),s("success",(0,o.__)("Collect PII status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}},help:(0,o.__)("Share additional customer data (PII) with both Pixel and Conversions API events to improve ads measurement.","snapchat-for-woocommerce")})})]})}):(0,g.jsx)(l.A,{})};var N=n(5659),T=n(3666);const D=()=>{(0,a.A)();const{isConnected:e,hasFinishedResolution:t}=(0,s.A)(),n="success"===(0,r.getQuery)()?.onboarding;return(0,c.useEffect)(()=>{!e&&t&&(0,r.getHistory)().replace((0,T.xP)())},[e,t]),(0,g.jsxs)("div",{className:"sfw-settings",children:[n&&(0,g.jsx)(N.A,{}),(0,g.jsx)(u.A,{title:(0,o.__)("Product Catalog","snapchat-for-woocommerce"),children:(0,g.jsx)(E,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Track Conversions","snapchat-for-woocommerce"),description:(0,o.__)("Manage how conversions are tracked on your site.","snapchat-for-woocommerce"),children:(0,g.jsx)(I,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Manage Snapchat Connection","snapchat-for-woocommerce"),description:(0,o.__)("See your currently connected account or disconnect.","snapchat-for-woocommerce"),children:(0,g.jsx)(j,{})})]})}},9031:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-notice-outline",s,!!function(e){return 0==e%18}(n)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}}}]);
     7(0,o.__)("Last exported on %s.","snapchat-for-woocommerce"),d):(0,o.__)("Your product catalog is not synced to Snapchat yet. Generate a CSV to manually upload.","snapchat-for-woocommerce"),indicator:h?(0,g.jsx)(m.Flex,{spacing:4,wrap:"wrap",children:(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_regenerate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Regenerate CSV","snapchat-for-woocommerce")})}):(0,g.jsx)(i.A,{variant:"secondary",onClick:_,loading:a,eventName:"sfw_generate_csv_button_click",eventProps:{context:"settings"},children:(0,o.__)("Generate CSV","snapchat-for-woocommerce")}),children:d&&!l&&(0,g.jsx)("div",{className:"sfw-product-catalog__help",children:(0,g.jsx)("p",{children:(0,o.__)('The CSV file may have been deleted and could not be found. Click "Generate CSV" to regenerate a new one.',"snapchat-for-woocommerce")})})})})},I=()=>{const{capiEnabled:e,collectPii:t,hasFinishedResolution:n}=(0,k.A)(),[r,a]=(0,c.useState)(!1),{createNotice:s}=(0,P.A)(),{updateSettings:i}=(0,p.j)(),u=(0,c.useCallback)(async()=>{const{settings:{capiEnabled:t}}=await i({capiEnabled:!e});(0,b.Sf)("sfw_conversion_tracking_toggle",{status:t?"on":"off"})},[i,e]),d=(0,c.useCallback)(async()=>{const{settings:{collectPii:e}}=await i({collectPii:!t});(0,b.Sf)("sfw_collect_pii_toggle",{status:e?"on":"off"})},[i,t]);return n?(0,g.jsx)(S.A,{className:"sfw-settings-track-conversions",title:(0,o.__)("Conversions API","snapchat-for-woocommerce"),description:(0,o.__)("Send server-side conversion events to improve attribution.","snapchat-for-woocommerce"),actions:(0,g.jsxs)("div",{className:"sfw-settings-track-conversions__actions",children:[(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Enable Conversions API tracking","snapchat-for-woocommerce"),checked:e,disabled:r,onChange:async()=>{try{a(!0),await u(),s("success",(0,o.__)("Conversions API Tracking status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}}})}),(0,g.jsx)("p",{children:(0,g.jsx)(m.CheckboxControl,{label:(0,o.__)("Collect Customer PII","snapchat-for-woocommerce"),checked:t,disabled:r,onChange:async()=>{try{a(!0),await d(),s("success",(0,o.__)("Collect PII status updated successfully.","snapchat-for-woocommerce"))}catch(e){}finally{a(!1)}},help:(0,o.__)("Share additional customer data (PII) with both Pixel and Conversions API events to improve ads measurement.","snapchat-for-woocommerce")})})]})}):(0,g.jsx)(l.A,{})};var N=n(5659),T=n(3666),D=n(2465);const F=()=>{(0,a.A)();const{isConnected:e,hasFinishedResolution:t}=(0,s.A)(),n="success"===(0,r.getQuery)()?.onboarding;return(0,c.useEffect)(()=>{!e&&t&&(0,r.getHistory)().replace((0,T.xP)())},[e,t]),(0,g.jsxs)("div",{className:"sfw-settings",children:[n&&(0,g.jsx)(N.A,{}),C.nP.isLegacyPluginActive&&(0,g.jsx)(u.A,{children:(0,g.jsx)(D.A,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Product Catalog","snapchat-for-woocommerce"),children:(0,g.jsx)(E,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Track Conversions","snapchat-for-woocommerce"),description:(0,o.__)("Manage how conversions are tracked on your site.","snapchat-for-woocommerce"),children:(0,g.jsx)(I,{})}),(0,g.jsx)(u.A,{title:(0,o.__)("Manage Snapchat Connection","snapchat-for-woocommerce"),description:(0,o.__)("See your currently connected account or disconnect.","snapchat-for-woocommerce"),children:(0,g.jsx)(j,{})})]})}},9031:(e,t,n)=>{"use strict";t.A=function(e){var t=e.size,n=void 0===t?24:t,o=e.onClick,s=(e.icon,e.className),i=function(e,t){if(null==e)return{};var n,o,c=function(e,t){if(null==e)return{};var n,o,c={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}(e,r),l=["gridicon","gridicons-notice-outline",s,!!function(e){return 0==e%18}(n)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",a({className:l,height:n,width:n,onClick:o},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))};var o,c=(o=n(1609))&&o.__esModule?o:{default:o},r=["size","onClick","icon","className"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)}}}]);
  • snapchat-for-woocommerce/trunk/js/src/components/section/index.js

    r3368691 r3408534  
    4343    return (
    4444        <section className={ sectionClassName }>
    45             <header className="sfw-section__header">
    46                 { topContent && <p>{ topContent }</p> }
    47                 { title && <h1>{ title }</h1> }
    48                 { description }
    49             </header>
     45            { ( topContent || title || description ) && (
     46                <header className="sfw-section__header">
     47                    { topContent && <p>{ topContent }</p> }
     48                    { title && <h1>{ title }</h1> }
     49                    { description }
     50                </header>
     51            ) }
    5052            <Flex
    5153                className="sfw-section__body"
  • snapchat-for-woocommerce/trunk/js/src/pages/settings/index.js

    r3368691 r3408534  
    1717import OnboardingSuccessModal from '~/components/onboarding-success-modal';
    1818import { getOnboardingUrl } from '~/utils/urls';
     19import LegacyPluginActiveNotice from '~/components/legacy-plugin-active-notice';
     20import { sfwData } from '~/constants';
    1921import './index.scss';
    2022
     
    3739        <div className="sfw-settings">
    3840            { isOnboardingSuccessModalOpen && <OnboardingSuccessModal /> }
     41
     42            { sfwData.isLegacyPluginActive && (
     43                <Section>
     44                    <LegacyPluginActiveNotice />
     45                </Section>
     46            ) }
    3947
    4048            <Section
  • snapchat-for-woocommerce/trunk/package-lock.json

    r3368691 r3408534  
    4949                "stylelint-config-standard-scss": "^15.0.1",
    5050                "typescript": "^5.5.4",
    51                 "woocommerce-grow-jsdoc": "https://gitpkg.now.sh/woocommerce/grow/packages/js/jsdoc?eabdb5c3e6f089499a9bc62ec2e5e2251d7b23ca"
     51                "woocommerce-grow-jsdoc": "git+https://github.com/woocommerce/grow#jsdoc-v1"
    5252            },
    5353            "engines": {
     
    3374133741        },
    3374233742        "node_modules/woocommerce-grow-jsdoc": {
    33743             "version": "0.0.2",
    33744             "resolved": "https://gitpkg.now.sh/woocommerce/grow/packages/js/jsdoc?eabdb5c3e6f089499a9bc62ec2e5e2251d7b23ca",
    33745             "integrity": "sha512-r8yvGjSD7DSEfg6OsuEFnjIcsR8kZ8NRWclNAbTssgnSoZzwRU0hzGnGTHHa3wfrK5M8KjPtZvmZfofQbCQPqw==",
     33743            "version": "1.0.0",
     33744            "resolved": "git+ssh://[email protected]/woocommerce/grow.git#d1822ab1ad130d28d096845798200782e3a8f59d",
    3374633745            "dev": true,
    3374733746            "license": "GPL-3.0-or-later",
     
    3375233751                "jsdoc-plugin-typescript": "^2.2.1",
    3375333752                "shelljs": "^0.8.5",
    33754                 "woocommerce-grow-tracking-jsdoc": "https://gitpkg.now.sh/woocommerce/grow/packages/js/tracking-jsdoc?a22d3df5e1b121ab186c57fa4fb9bbc989c86fba"
     33753                "woocommerce-grow-tracking-jsdoc": "git+https://github.com/woocommerce/grow#tracking-jsdoc-v1"
    3375533754            },
    3375633755            "bin": {
    3375733756                "woocommerce-grow-jsdoc": "bin/jsdoc.mjs"
     33757            },
     33758            "engines": {
     33759                "node": ">=16"
    3375833760            }
    3375933761        },
    3376033762        "node_modules/woocommerce-grow-tracking-jsdoc": {
    33761             "version": "0.0.2",
    33762             "resolved": "https://gitpkg.now.sh/woocommerce/grow/packages/js/tracking-jsdoc?a22d3df5e1b121ab186c57fa4fb9bbc989c86fba",
    33763             "integrity": "sha512-RMZecq3RbgutjnmAbrO0dLBQ/MX3i/kQXyHGeYITocOIDZIabUX6mvEEK2uHu2frtvAVn154u3upEMk7X8JZnw==",
     33763            "version": "1.0.0",
     33764            "resolved": "git+ssh://[email protected]/woocommerce/grow.git#ac115c64c5427ae6b2a9d9ccd0498e82a1864a8e",
    3376433765            "dev": true,
    3376533766            "license": "GPL-3.0-or-later",
     33767            "engines": {
     33768                "node": ">=16"
     33769            },
    3376633770            "peerDependencies": {
    3376733771                "jsdoc": "^4.0.2"
  • snapchat-for-woocommerce/trunk/package.json

    r3368691 r3408534  
    5757        "stylelint-config-standard-scss": "^15.0.1",
    5858        "typescript": "^5.5.4",
    59         "woocommerce-grow-jsdoc": "https://gitpkg.now.sh/woocommerce/grow/packages/js/jsdoc?eabdb5c3e6f089499a9bc62ec2e5e2251d7b23ca"
     59        "woocommerce-grow-jsdoc": "git+https://github.com/woocommerce/grow#jsdoc-v1"
    6060    },
    6161    "overrides": {
  • snapchat-for-woocommerce/trunk/readme.txt

    r3368695 r3408534  
    22Contributors: automattic, woocommerce
    33Tags: woocommerce, snapchat, product feed, ads
    4 Tested up to: 6.8
    5 Stable tag: 1.0.0
     4Tested up to: 6.9
     5Stable tag: 1.0.1
    66License: GPLv3
    77License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • snapchat-for-woocommerce/trunk/snapchat-for-woocommerce.php

    r3368691 r3408534  
    33 * Plugin Name: Snapchat for WooCommerce
    44 * Description: Seamlessly integrates your WooCommerce store with Snapchat's powerful advertising platform, enabling you to reach millions of potential customers through engaging visual ads.
    5  * Version: 1.0.0
     5 * Version: 1.0.1
    66 * Author: WooCommerce
    77 * Author URI: https://woocommerce.com/
     
    1010 * Requires Plugins: woocommerce
    1111 * Requires PHP: 7.4
     12 * PHP tested up to: 8.4
    1213 * Requires at least: 6.7
    13  * WC requires at least: 10.0
    14  * WC tested up to: 10.2
     14 * Tested up to: 6.9
     15 * WC requires at least: 10.1
     16 * WC tested up to: 10.3
    1517 *
    1618 * License: GNU General Public License v3.0
     
    2830
    2931if ( ! defined( 'SNAPCHAT_FOR_WOOCOMMERCE_VERSION' ) ) {
    30     define( 'SNAPCHAT_FOR_WOOCOMMERCE_VERSION', '1.0.0' );
     32    define( 'SNAPCHAT_FOR_WOOCOMMERCE_VERSION', '1.0.1' );
    3133}
    3234
  • snapchat-for-woocommerce/trunk/vendor/autoload.php

    r3368691 r3408534  
    1515        }
    1616    }
    17     throw new RuntimeException($err);
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
    1821}
    1922
  • snapchat-for-woocommerce/trunk/vendor/composer/InstalledVersions.php

    r3368691 r3408534  
    2727class InstalledVersions
    2828{
    29     /**
    30      * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
    31      * @internal
    32      */
    33     private static $selfDir = null;
    34 
    3529    /**
    3630     * @var mixed[]|null
     
    330324
    331325    /**
    332      * @return string
    333      */
    334     private static function getSelfDir()
    335     {
    336         if (self::$selfDir === null) {
    337             self::$selfDir = strtr(__DIR__, '\\', '/');
    338         }
    339 
    340         return self::$selfDir;
    341     }
    342 
    343     /**
    344326     * @return array[]
    345327     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     
    355337
    356338        if (self::$canGetVendors) {
    357             $selfDir = self::getSelfDir();
     339            $selfDir = strtr(__DIR__, '\\', '/');
    358340            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    359341                $vendorDir = strtr($vendorDir, '\\', '/');
  • snapchat-for-woocommerce/trunk/vendor/composer/installed.php

    r3368691 r3408534  
    44        'pretty_version' => 'dev-trunk',
    55        'version' => 'dev-trunk',
    6         'reference' => '8c3fe001e8cc2b8c6331b6f52be630213f5f80c0',
     6        'reference' => 'd72595c4aa920d0a593bb5586ef5896fc1f5b3f6',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    2323            'pretty_version' => 'dev-trunk',
    2424            'version' => 'dev-trunk',
    25             'reference' => '8c3fe001e8cc2b8c6331b6f52be630213f5f80c0',
     25            'reference' => 'd72595c4aa920d0a593bb5586ef5896fc1f5b3f6',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.