=== Pukulink ===
Contributors: pukuo
Tags: affiliate, amazon, rakuten, yahoo-shopping, classic-editor
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.6.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Create affiliate product links for Amazon, Rakuten Ichiba, and Yahoo! Shopping from the Classic Editor or Block Editor.

== Description ==

Pukulink lets you search for products, insert product cards, keep prices up to date, and track link clicks from within WordPress.

* Works with both the Classic Editor and the Block Editor.
* Search Amazon, Rakuten Ichiba, and Yahoo! Shopping, then insert a product card.
* Save favorite Rakuten Ichiba and Yahoo! Shopping stores and search within a specific store.
* Link products that you have confirmed are the same item across stores, then show each store's price and retrieval date on one card.
* Refine the search keyword used by stores that do not have a linked product. The card title remains unchanged.
* Includes automatic price updates, per-card price visibility, sale labels, review links, and click tracking.
* When Amazon Creators API eligibility is temporarily unavailable, Amazon search links can still be inserted.
* Includes six templates: Standard, Compact, Large Card, Modern, Text Link, and Comparison Buttons.
* Optionally show extra Amazon or Rakuten Ichiba product photos as a gallery on the Standard, Large Card, and Modern templates, with swipe, arrow buttons, and keyboard support. Each card can override the site setting to always show or always hide its gallery.
* AI markers let you replace `[pukulink_draft keyword="product name"]` placeholders with product cards after reviewing search results. Each product is selected and confirmed by the user.
* Optionally outputs schema.org Product/Offer JSON-LD.
* Rakuten Ichiba and Yahoo! Shopping links can also use Moshimo Affiliate by importing IDs from Easy Link code.
* The Product Health report lists products that may no longer be available.
* Export settings, the product registry, history, and click totals as JSON.

In accordance with the Yahoo! Shopping API guidelines, Pukulink automatically displays the required Web Services by Yahoo! JAPAN attribution at the bottom of pages that show Yahoo! product information.

Posts store the portable `[pukulink]` shortcode. Affiliate URLs are assembled when a page is displayed, so changing a setting updates existing cards without editing each post.

== Installation ==

1. Upload `pukulink.zip` from **Plugins > Add New > Upload Plugin**.
2. Activate Pukulink.
3. Open **Settings > Pukulink** and enter the credentials for the services you want to use.
4. Search for a product from the **Add Pukulink** button in the post editor or the **Pukulink** block in the Block Editor. Searching for “Product Link” also finds the block.

Pukulink 2.0.0 and later are a clean, independent plugin. Settings, history, click totals, and product cards from the pre-2.0 version are not migrated. Re-create any product cards you need with this version.

== Frequently Asked Questions ==

= Why can’t I search Amazon products? =

Check the Creators API Client ID, Client Secret, Associate ID, and your Amazon Associates eligibility. Even when eligibility is temporarily unavailable, you can create an Amazon search link.

= When are prices updated? =

WP-Cron runs hourly and gradually refreshes products displayed within the last 30 days after their configured cache period has expired. On low-traffic sites, schedule `wp-cron.php` with your server’s cron service for more reliable updates.

= Are settings migrated from an older version? =

No. Pukulink 2.0.0 does not migrate the previous plugin’s settings or product cards. This keeps all identifiers consistent under the Pukulink name.

= Why are Rakuten searches or price updates not working? =

Support for the legacy Rakuten API ends on August 17, 2026. Register an application for the current Rakuten Web Service API and configure both the Application ID and an access key beginning with `pk_`. You must also register your site URL as an allowed website for the application.

== External Services ==

Pukulink communicates only with services that the site administrator enables and configures. Requests are used for product search, store verification, price updates, or affiliate-link generation. Credentials such as Client Secrets are never sent to or stored on servers operated by the plugin developer or any destination other than the relevant service.

= Amazon Creators API =

* Destination: `api.amazon.co.jp` or `creatorsapi.auth.us-west-2.amazoncognito.com` for OAuth authentication, and `creatorsapi.amazon` for product search and price retrieval.
* Data sent: Client ID, Client Secret, Associate ID, product search terms, ASINs, and marketplace information.
* Purpose: Obtain OAuth tokens, search Amazon products, and refresh prices.
* Terms and policies: https://affiliate.amazon.co.jp/help/operating/agreement/ and https://www.amazon.co.jp/gp/help/customer/display.html?nodeId=GX7NJQ4ZB8MHFRNJ

= Rakuten Ichiba Product Search API / Rakuten Affiliate =

* Destination: `openapi.rakuten.co.jp` for product search and price retrieval, and `hb.afl.rakuten.co.jp` for affiliate links clicked by visitors.
* Data sent: Application ID, access key, product search terms, product codes, favorite-store codes, and the site's Origin header.
* Purpose: Search Rakuten Ichiba products, verify stores, refresh prices, and generate affiliate links.
* Terms and policies: https://webservice.rakuten.co.jp/guide/rule and https://privacy.rakuten.co.jp/

= Yahoo! Shopping (Japan) Product Search API / ValueCommerce =

* Destination: `shopping.yahooapis.jp` for product search and price retrieval, and `ck.jp.ap.valuecommerce.com` for affiliate links clicked by visitors.
* Data sent: Yahoo! Client ID, product search terms, JAN codes, and store IDs.
* Purpose: Search Yahoo! Shopping products, verify stores, refresh prices, and generate affiliate links.
* Terms and policies: https://developer.yahoo.co.jp/guideline/ and https://privacy.yahoo.co.jp/

= Moshimo Affiliate (optional) =

* Destination: `af.moshimo.com` and `i.moshimo.com`.
* Data sent: Product URLs for Amazon, Rakuten Ichiba, or Yahoo! Shopping (Japan), and Moshimo Affiliate promotion IDs.
* Purpose: Generate affiliate links and impression beacons for stores configured to use Moshimo Affiliate.
* Terms and policies: https://af.moshimo.com/af/www/terms/shop and https://www.moshimo.co.jp/company/privacy

== Changelog ==

= 2.6.4 =

* Added a per-card override for the image gallery (always show / always hide), matching the existing per-card price display option. You can now try the gallery on a single product before turning it on site-wide.

= 2.6.2 =

* Added an optional image gallery for Amazon and Rakuten Ichiba products, with swipe, arrow buttons, and keyboard support. Turn it on under Display & Design, then choose "Include extra photos" for individual product cards when inserting them. Off by default; existing cards are unaffected.

= 2.5.5 =

* Resolved all issues reported by the official Plugin Check tool: escaped the editor button output at the point of output, added a missing translators comment, and corrected nonce-verification annotations for two read-only admin query parameters. No functional or visual changes.

= 2.5.4 =

* Prepared the WordPress.org distribution package: translated this readme into English, corrected external-service policy links, removed the obsolete manual translation loader, and excluded bundled Japanese translations and Japanese development documentation from the release ZIP. WordPress.org translations are loaded from translate.wordpress.org.

= 2.5.3 =

* Fixed a case where the mobile layout fix did not apply to landscape iPhones with a wide CSS viewport. Preview actions now remain visible on short landscape touch screens.

= 2.5.2 =

* Fixed the Insert button being hidden below the browser UI in some landscape mobile previews.

= 2.5.1 =

* Added an editable search keyword in the insert preview for stores without a linked product. Leaving it blank falls back to the card title.
* Preserved in-progress link text, price visibility, and search keywords when changing the main store.

= 2.5.0 =

* Added per-card price visibility and sequential processing for multiple AI markers.

= 2.4.20 =

* Fixed Modern template buttons becoming vertical at some widths.

= 2.4.19 =

* Made lower Modern template buttons size themselves according to label length and vertically centered their text.

= 2.4.18 =

* Renamed the Block Editor entry block to Pukulink and the saved card block to Pukulink Card. Internal block names and existing shortcodes are unchanged.

= 2.4.17 =

* Updated Modern template button placement and renamed the Classic Editor insert button to Add Pukulink.

= 2.4.16 =

* Restored white text as the default for filled store buttons and added per-store text-color settings.

= 2.4.15 =

* Added dark-mode support and configurable automatic, light, or dark card color schemes for all templates.

= 2.4.14 =

* Added initial dark-mode support for the Modern template and improved button contrast handling.

= 2.4.13 =

* Enabled store buttons in the insert preview so linked product pages or search results can be checked in a new tab or verification window. Links in saved editor cards remain disabled.

= 2.4.12 =

* Used the original search term, rather than a long product title, for unlinked store search URLs. Unified the product-search modal layout across stores.

= 2.4.11 =

* Added Block Editor guidance to the Help tab, including how to use the entry block, the saved card block, and shortcode conversion.

= 2.4.10 =

* Prevented a rare unintended insertion after closing the modal during preview generation.

= 2.4.9 =

* Fixed text-link editing so legacy links retain their intended store, and fixed one-click insertion immediately after editing link text.

= 2.4.8 =

* Refined the insert preview and search modal layout, including mobile input height and text-link display text.

= 2.4.7 =

* Added template-name badges to editor cards and editable display text for Text Link templates.

= 2.4.6 =

* Updated WordPress.org submission metadata and WordPress 7.0 compatibility information.

= 2.4.5 =

* Clarified that the insertion history retains the latest 50 items.

= 2.4.4 =

* Added configurable store order and independent Modern template store colors.

= 2.4.3 =

* Fixed Modern template store colors not being applied to rendered cards and refined preview controls.

= 2.4.2 =

* Added searchable, paginated insertion history and improved preview, registry, and click-tracking reliability.

= 2.4.1 =

* Kept the insert action visible in long previews and refined preview controls.

= 2.4.0 =

* Internationalized the plugin source and added Japanese translation files and a translation template for development.

= 2.3.0 =

* Added Moshimo Affiliate support for Rakuten and Yahoo!, Product Health reporting, JSON export, price-history collection, and Rakuten legacy API expiry guidance.

= 2.2.0 =

* Added AI markers and optional Product/Offer JSON-LD output.

= 2.1.3 =

* Updated the author name to Pukuo and standardized the Classic Editor button icon size.

= 2.1.2 =

* Simplified Classic Editor card display choices and removed the image-and-caption mode.

= 2.1.1 =

* Fixed an editor icon that could appear too large and made product cards the default editor display for new installations.

= 2.1.0 =

* Added Modern and Comparison Buttons templates, service attribution, and guidance for the Rakuten API transition.

= 2.0.2 =

* Unified the settings-page name and editor launch icons under Pukulink.

= 2.0.1 =

* Unified Classic and Block Editor launch icons.

= 2.0.0 =

* Renamed the plugin, slug, text domain, main file, and shortcode identifiers to Pukulink. Older cards and settings are not migrated.

== Upgrade Notice ==

= 2.5.4 =

This release prepares the package for WordPress.org review. Existing cards and settings are unchanged.

= 2.5.3 =

Fixes insert-preview controls on landscape iPhones.

= 2.5.2 =

Improves insert-preview controls on landscape mobile devices.

= 2.5.1 =

You can now refine the search keyword used by unlinked store buttons. Existing cards are unchanged.

= 2.5.0 =

Adds per-card price visibility and sequential processing for multiple AI markers. Existing shortcodes need no changes.

= 2.4.20 =

Fixes Modern template lower-button layout at some widths.

= 2.4.19 =

Improves Modern template button sizing and vertical alignment. Existing card shortcodes are unchanged.

= 2.4.18 =

Renames the Block Editor blocks to Pukulink and Pukulink Card. Existing posts and links are unchanged.

= 2.4.17 =

Updates Modern template button placement and the Classic Editor insert button name. Existing cards are unchanged.

= 2.4.16 =

Filled button text is white by default and can be customized per store. Existing cards and links are unchanged.

= 2.4.15 =

All templates now support dark mode. Existing cards and links are unchanged.

= 2.4.14 =

Improves Modern template dark mode and button-text readability. Existing cards and links are unchanged.

= 2.4.13 =

You can check linked store pages from insert-preview buttons. Editor and public-page link behavior is unchanged.

= 2.4.12 =

Unlinked store buttons use a more focused search keyword. Existing cards display as before.

= 2.4.11 =

Adds Block Editor guidance to the Help tab. No existing content is affected.

= 2.4.10 =

Fixes a possible unintended insertion while adding a product link. Existing content is unchanged.

= 2.4.9 =

Fixes text-link editing behavior. Existing card display and saved content are unchanged.

= 2.4.8 =

Refines the insert-preview and search-modal UI. Existing cards are unchanged.

= 2.4.7 =

Adds editor template badges and editable Text Link display text. Existing posts are unchanged.

= 2.4.4 =

You can configure store display order. The setting applies to all existing cards.

= 2.4.3 =

Fixes Modern template store-color rendering. Existing cards are unchanged.

= 2.4.2 =

Improves reliability and usability, including click tracking, preview handling, and searchable history.

= 2.4.1 =

Improves insert-preview controls and keeps the Insert action visible.

= 2.4.0 =

Internationalizes the plugin source. Japanese UI remains available through WordPress.org translations after publication.

= 2.3.0 =

Adds Moshimo links for Rakuten and Yahoo!, Product Health reporting, and data export. Existing posts are unchanged.

= 2.2.0 =

Adds AI markers and JSON-LD output. Existing posts are unchanged.

= 2.1.2 =

Simplifies editor card display choices. Saved image-and-caption settings now use the product-card display; public content is unchanged.

= 2.1.0 =

Adds Modern and Comparison Buttons templates and service attribution. Configure a Rakuten access key before the legacy API ends on August 17, 2026.

= 2.0.2 =

Renames the WordPress settings menu and editor launch icon. Existing posts are unchanged.

= 2.0.1 =

Updates the product-link launch icon. Existing posts are unchanged.

= 2.0.0 =

Pukulink unifies the display name, internal identifiers, and shortcode under `pukulink`. Older product cards and settings are not migrated.
