This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ShopifyApiWrapper | |
class Theme | |
class << self | |
def app_embed_activated?(session:, theme_app_extension_id:) | |
new(session: session) | |
.app_embed_activated?(theme_app_extension_id: theme_app_extension_id) | |
end | |
end | |
def initialize(session:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shop-specific webhooks need to be deleted before migration into App-specific webhooks | |
# Unless they will be triggered twice | |
require "mongo" | |
require "shopify_api" | |
def remove_webhook(shopify_domain, access_token) | |
# Get webhook | |
query = <<~GRAPHQL | |
query { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Red | |
Rails.logger.info "\e[31m[Error] Something went wrong\e[0m" | |
# Green | |
Rails.logger.info "\e[32m[Success] Operation completed\e[0m" | |
# Yellow | |
Rails.logger.info "\e[33m[Warning] Approaching limit\e[0m" | |
# Blue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Documentation: https://shopify.dev/docs/apps/build/online-store/theme-app-extensions/configuration#detecting-app-blocks-and-app-embed-blocks | |
module ShopifyApiWrapper | |
class Theme | |
class << self | |
def app_embed_activated?(session:, theme_app_extension_id:) | |
new(session: session) | |
.app_embed_activated?(theme_app_extension_id: theme_app_extension_id) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const regionNames = new Intl.DisplayNames( | |
['en'], {type: 'region'} | |
); | |
console.log(regionNames.of('US')); // 👉️ "United States" | |
console.log(regionNames.of('GB')); // 👉️ "United kingdom" | |
console.log(regionNames.of('DE')); // 👉️ "Germany" | |
console.log(regionNames.of('AU')); // 👉️ "Australia" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AppProxyVerification | |
extend ActiveSupport::Concern | |
included do | |
skip_before_action :verify_authenticity_token, raise: false | |
before_action :verify_request | |
end | |
private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org_id = 'your_org_id' | |
access_token = 'your_partner_api_access_token' | |
api_version = 'shopify_api_version' # example: '2024-01' | |
app_id = "gid://partners/App/your_app_id" | |
occurred_at_min = 'specific_time' # example: '2024-01-02T23:15:27.000000Z' | |
uri = URI("https://partners.shopify.com/#{org_id}/api/#{api_version}/graphql.json") | |
request = Net::HTTP::Post.new(uri) | |
request['Content-Type'] = 'application/json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
isShopifyEmbedded, | |
isMobile, | |
isShopifyMobile, | |
isShopifyPOS | |
} from '@shopify/app-bridge/utilities'; | |
const onShopifyEmbedded = isShopifyEmbedded(); | |
const onMobile = isMobile(); | |
const onShopifyMobile = isShopifyMobile(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"label": "(UTC-12:00) Etc/GMT+12", | |
"rails_timezone": "International Date Line West", | |
"tzinfo_identifier": "Etc/GMT+12" | |
}, | |
{ | |
"label": "(UTC-11:00) Pacific/Pago_Pago", | |
"rails_timezone": "American Samoa", | |
"tzinfo_identifier": "Pacific/Pago_Pago" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
useCallback, | |
useState, | |
} from "react"; | |
import { | |
Button, | |
Checkbox, | |
Collapsible, | |
Icon, | |
Modal, |