{"version":3,"file":"Shopify_utils.DQ9OZXFO.mjs","names":[],"sources":["https:/framerusercontent.com/modules/tzN8qHzrVYThnxhKObeP/oWpbtfeZjvritjXviKiH/Shopify_utils.js"],"sourcesContent":["/**\n * Utility functions for working with Shopify GraphQL IDs (GIDs)\n *//**\n * Creates a Shopify GraphQL ID (GID) for any Shopify resource type\n * @param type - The Shopify resource type (e.g., \"Product\", \"ProductVariant\", \"Collection\")\n * @param id - The numeric/string ID of the resource\n * @returns The full GID string\n *\n * @example\n * createShopifyGid(\"Product\", \"123456789\") // \"gid://shopify/Product/123456789\"\n */export function createShopifyGid(type,id){return`gid://shopify/${type}/${id}`;}/**\n * Creates a Shopify Product GID\n * @param productId - The product ID\n * @returns The product GID\n *\n * @example\n * createProductGid(\"123456789\") // \"gid://shopify/Product/123456789\"\n */export function createProductGid(productId){return createShopifyGid(\"Product\",productId);}/**\n * Creates a Shopify ProductVariant GID\n * @param variantId - The variant ID\n * @returns The variant GID\n *\n * @example\n * createVariantGid(\"987654321\") // \"gid://shopify/ProductVariant/987654321\"\n */export function createVariantGid(variantId){return createShopifyGid(\"ProductVariant\",variantId);}/**\n * Creates a Shopify Collection GID\n * @param collectionId - The collection ID\n * @returns The collection GID\n *\n * @example\n * createCollectionGid(\"555666777\") // \"gid://shopify/Collection/555666777\"\n */export function createCollectionGid(collectionId){return createShopifyGid(\"Collection\",collectionId);}/**\n * Extracts the ID from a Shopify GraphQL ID (GID)\n * @param gid - The full GID string\n * @returns The extracted ID string\n * @throws Error if the GID format is invalid\n *\n * @example\n * extractIdFromGid(\"gid://shopify/Product/123456789\") // \"123456789\"\n */export function extractIdFromGid(gid){const match=gid.match(/^gid:\\/\\/shopify\\/[^\\/]+\\/(.+)$/);if(!match){throw new Error(`Invalid Shopify GID format: ${gid}`);}return match[1];}/**\n * Parses a Shopify GraphQL ID (GID) into its components\n * @param gid - The full GID string\n * @returns An object containing the resource type and ID\n * @throws Error if the GID format is invalid\n *\n * @example\n * parseShopifyGid(\"gid://shopify/Product/123456789\") // { type: \"Product\", id: \"123456789\" }\n */export function parseShopifyGid(gid){const match=gid.match(/^gid:\\/\\/shopify\\/([^\\/]+)\\/(.+)$/);if(!match){throw new Error(`Invalid Shopify GID format: ${gid}`);}return{type:match[1],id:match[2]};}/**\n * Extracts the product ID from a Shopify Product GID\n * @param gid - The product GID\n * @returns The product ID\n *\n * @example\n * extractProductId(\"gid://shopify/Product/123456789\") // \"123456789\"\n */export function extractProductId(gid){const{type,id}=parseShopifyGid(gid);if(type!==\"Product\"){throw new Error(`Expected Product GID, got ${type}: ${gid}`);}return id;}/**\n * Extracts the variant ID from a Shopify ProductVariant GID\n * @param gid - The variant GID\n * @returns The variant ID\n *\n * @example\n * extractVariantId(\"gid://shopify/ProductVariant/987654321\") // \"987654321\"\n */export function extractVariantId(gid){const{type,id}=parseShopifyGid(gid);if(type!==\"ProductVariant\"){throw new Error(`Expected ProductVariant GID, got ${type}: ${gid}`);}return id;}/**\n * Extracts the collection ID from a Shopify Collection GID\n * @param gid - The collection GID\n * @returns The collection ID\n *\n * @example\n * extractCollectionId(\"gid://shopify/Collection/555666777\") // \"555666777\"\n */export function extractCollectionId(gid){const{type,id}=parseShopifyGid(gid);if(type!==\"Collection\"){throw new Error(`Expected Collection GID, got ${type}: ${gid}`);}return id;}\nexport const __FramerMetadata__ = {\"exports\":{\"extractProductId\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createVariantGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createCollectionGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"extractCollectionId\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createShopifyGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"extractVariantId\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createProductGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"parseShopifyGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"extractIdFromGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shopify_utils.map"],"mappings":"oDAUG,SAAgB,EAAiB,EAAK,EAAG,CAAC,MAAM,iBAAiB,EAAK,GAAG,IAOzE,SAAgB,EAAiB,EAAU,CAAC,OAAO,EAAiB,UAAU,EAAU,CAOxF,SAAgB,EAAiB,EAAU,CAAC,OAAO,EAAiB,iBAAiB,EAAU,CAuB/F,SAAgB,EAAgB,EAAI,CAAC,IAAM,EAAM,EAAI,MAAM,oCAAoC,CAAC,GAAG,CAAC,EAAO,MAAU,MAAM,+BAA+B,IAAM,CAAE,MAAM,CAAC,KAAK,EAAM,GAAG,GAAG,EAAM,GAAG,CAOnM,SAAgB,EAAiB,EAAI,CAAC,GAAK,CAAC,OAAK,MAAI,EAAgB,EAAI,CAAC,GAAG,IAAO,UAAW,MAAU,MAAM,6BAA6B,EAAK,IAAI,IAAM,CAAE,OAAO,EAOpK,SAAgB,EAAiB,EAAI,CAAC,GAAK,CAAC,OAAK,MAAI,EAAgB,EAAI,CAAC,GAAG,IAAO,iBAAkB,MAAU,MAAM,oCAAoC,EAAK,IAAI,IAAM,CAAE,OAAO"}